Class

We just mentioned that objects contain data, and code to manipulate that data. The entire set of data and code of an object can be made a user- defined data type with the help of a class, in fact, objects are variables of the type class. Once a class has been defined, we can created any number of objects belonging to that class. Each object is associated with the data of types class with the data of type class with which they are created. A class id=s thus a collection of objects of similar type,  For example,  mango, apple and orange are members of the class fruit. Classes are user-defined data types and behave like the built-in types of a programming language, The syntax used to create an object is no different then the syntax used to create an integer object in C. If fruit has been defined as class, then the statement 
   Fruit mango;
  will create an object mango belonging to the class fruit.

Comments

Popular posts from this blog

Reusability In OOP

Encapsulation and Data Abstraction In OOP

Polymorphism ,operator overloading,function overloading,dynamic binding