Concept of Class. A class is simply an abstract model used to define new data types. A class may contain any combination of encapsulated data (fields or member variables), operations that can be performed on the data (methods) and accessors to data (properties). For example, there is a class String in the System namespace of .Net Framework Class Library (FCL). This class contains an array of characters (data) and provide different operations (methods) that can be applied to its data like ToLowerCase(), Trim(), Substring(), etc. It also has some properties like Length (used to find the length of the string).A class in VB.Net is declared using the keyword Class and its members are enclosed with the End Class markerClass TestClass
' fields, operations and properties go here
End Class
Where TestClass is the name of the class or new data type that we are defining here.ObjectsAs mentioned above, a class is an abstract model. An object is the concrete realization or instance build on a model specified by the class. An object is created in memory using the 'New' keyword and is referenced by an identifier called a "reference".
Sunday, March 22, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment