Welcome to the new part of programming: Object Oriented Programming (OOPs). To understand this, think of a book having a serial number and a number of pages. Suppose, you have two books - a Science book and a Computer book. The serial number of Science book is SC12 and that of the Computer book is CS34 and the number of pages is 200 and 250 respectively. It is like in the picture below:
So, Book can be a class here having attributes page and serial number and Science and Computer are objects (instances) of it.
Basically, a class is something which acts like a base (or blueprint), having some definitions. And objects are instances of class following those definitions.
One more example of class and objects you can think of is a bank account. Think of Account as a class having attributes minBalance and rateOfInterest. And savingAccount and currentAccount are its objects.
Hopefully, you have got the feel of classes and objects. We will be dealing with programming parts in later chapters.
C# Member Methods
We already know what methods are. Member methods are methods defined inside a class. For example, there can be a method named GetStrength inside the Student class to get a total number of students. Here, GetStrength is the member method of the Student class.
Many times, we make a subclass of a class. For example, Student class can have BTech, MTech and Phd as its subclasses. Here, all three subclasses will have the properties of the parent class as well as some of their new properties.
All the shown methods and attributes of superclass will be shown by its subclass also. And subclass may have some different attributes in addition to those as well. Other names of superclass and subclass are base class and derived class respectively.
In this chapter, you have been introduced to some concepts of programming. In the following sections, you will go through the programming parts.