object and class

Class is a user defined data type. Once the data type class is defined then we can create an object of the class.
Thus the class is template for object.
And object is an instance of that class.
A class have attributes and methods. We can say class have properties and methods.

Syntax for class declaration:
                                 class Class_name{
                                                             // variable declaration 
                                                             datatype instance variable1;        
                                                            datatype instance variable2;    
                                                            // methods declaration     
                                                            Return _type method_name(parameter_list){
                                                             //body of method

  • A class is a blue print for an object
  • A object is like one entity in your address book
  • A class is a logical construct and object has physical entity                   


Post a Comment