X hits on this document

PDF document

“Beginning Visual C# 2005 Express Edition Video Series” - page 18 / 73

196 views

0 shares

0 downloads

0 comments

18 / 73

Just like in the real world, you take a blueprint to a contractor, or take the blueprint to a baker and they create an instance of that blueprint, resulting in a house or a cookie respectively. In our case, we'll create an instance of the class. The instance is a manifestation of that class, which we then call an Object. So let’s define a class:

Visual Basic:

Class Car

End Class

This class does almost nothing. So let’s add some properties and methods.

Visual Basic:

Public Class Car Private m_make as string Private m_model as string

Public Property Make() as string Get() as string return m_make End Get Set(ByVal Value as string) m_make = Value End Set End Property

Public Function Drive() as string if make = "Oldsmobile" then return "Chicago" else return "Toledo" end if End Sub End Class

Admittedly, this class doesn’t do much but will allow us to see what a real Class looks like. First, it has two private fields and a public function. We talked briefly about scope in the videos, and the words "Private" and "Public" have special meaning in terms

Supplemental Readings for the Express Edition Videos Copyright © 2005 LearnVisualStudio.NET



Document info
Document views196
Page views196
Page last viewedFri Dec 09 14:26:36 UTC 2016
Pages73
Paragraphs821
Words15988

Comments