When we come to talk about object-oriented programming in a language, we always begin with Class. A Class is a template that can be used to create an object. Therefore, object is the instance of the class.
To create a class, you must use class keyword followed by the name of the class.
A class can have three types of members-privat, public, and protected members. Private member can’t be accessed by the code outside the class. In contrast, public member can be accessed by the code outside the class. To declare a private member, you can use private keyword and to declare a public member you will use the public keyword. The protected keyword is used to define a protected member in relalationship between base class and derived class.
private int stnumber;
public string stname;
public string stsex;
This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages: