Planet For Application Life Development Presents
MY IT World

Explore and uptodate your technology skills...

VB.Net - Classes & Objects

When you define a class, you define a blueprint for a data type. 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.

Objects are instances of a class. The methods and variables that constitute a class are called members of the class.

Class Definition

A class definition starts with the keyword Class followed by the class name; and the class body, ended by the End Class statement. Following is the general form of a class definition:

[ <attributelist> ] [ accessmodifier ] [ Shadows ] [ MustInherit | NotInheritable ] [ Partial ] _
Class name [ ( Of typelist ) ]
    [ Inherits classname ]
    [ Implements interfacenames ]
    [ statements ]
End Class


  • attributelist is a list of attributes that apply to the class. Optional.

  • accessmodifier defines the access levels of the class, it has values as - Public, Protected, Friend, Protected Friend and Private. Optional.

  • Shadows indicate that the variable re-declares and hides an identically named element, or set of overloaded elements, in a base class. Optional.

  • 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. Optional.

  • NotInheritable specifies that the class cannot be used as a base class.

  • Partial indicates a partial definition of the class

  • Inherits specifies the base class it is inheriting from

  • Implements specifies the interfaces the class is inheriting from