VB.NET tutorial-Object-Oriented Programming

Object-Oriented Programming (OOP)

Classes and objects

Object-Oriented Programming (OOP) is an import feature in VB.NET. Once we talk about OOP, We always focus on classes and objects. A class is a template that can be used to create an object. Therefore, object is the instance of the class.

Creating a class

To create a class, you must use class keyword followed by the name of the class.
Class Student

End Class

A class can have two types of members-private and public members. Private member can’t be accessed by the code outside the class. In contrast, public member can be access by the code outside the class. To declare a private member, you can use private keyword and to declare a public member, you can use public keyword. Variables declared without private or public keyword are private members.


Class Student
        Private stnumber As Integer
        Private stname As String
        Private stsex As String
        Public sub setnumber
        End sub
End class


raymond comment




This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages:
C, C++, C#, Java, VB.NET, Python, VBA,PHP & Mysql, SQL, JSP, ASP.NET,HTML, CSS, JQuery, JavaScript and other applications such as MS Excel, MS Access, and MS Word. However, we don't guarantee all things of the web are accurate. If you find any error, please report it then we will take actions to correct it as soon as possible.