Public height As Double ' Height of a boxĭim Box1 As Box = New Box() ' Declare Box1 of type Boxĭim Box2 As Box = New Box() ' Declare Box2 of type Boxĭim volume As Double = 0.0 ' Store the volume of a box here Public breadth As Double ' Breadth of a box Public length As Double ' Length of a box The following example demonstrates a Box class, with three data members, length, breadth and height − Implements specifies the interfaces the class is inheriting from. Inherits specifies the base class it is inheriting from. Partial indicates a partial definition of the class. NotInheritable specifies that the class cannot be used as a base class. MustInherit specifies that the class can be used only as a base class and that you cannot create an object directly from it, i.e., an abstract class. Shadows indicate that the variable re-declares and hides an identically named element, or set of overloaded elements, in a base class. Optional.Īccessmodifier defines the access levels of the class, it has values as - Public, Protected, Friend, Protected Friend and Private. _Īttributelist is a list of attributes that apply to the class. Following is the general form of a class definition − Class DefinitionĪ class definition starts with the keyword Class followed by the class name and the class body, ended by the End Class statement. The methods and variables that constitute a class are called members of the class. This doesn't actually define any data, but it does define what the class name means, that is, what an object of the class will consist of and what operations can be performed on such an object. When you define a class, you define a blueprint for a data type.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |