Classes and Object

Introduction to Class and Object Class : Class is a user defined data type. A class is a logical abstraction. It is a template that defines the form of an object. A class specifies both code and data. When defined class, you declare data that it contains, and the code that operates on the data. Data is contained in instance variable defined by the class known as data members and code is contained in functions known as member functions. The code and the data that constitute a class are called members of the class. Object : Object is a variable of a class. It is an identifiable entity with specific characteristics (data members) and behaviour (member functions). Defining an object is similar to defining a variable of any data type. Example - In the above example, as we can see, test is a class. This class has integer data member - num , and two member functions - void getdata() and void showdata(). Also, in the same program, we have t1 as a variable of class te...