Saturday, October 28, 2017

Class

Classes:
o      Classes are user defined data types and it behaves like built in types of programming language.


o      Object contains code and data which can be made user define type using class.


o      Objects are variables of class.


o      Once a class has been defined we can create any number of objects for that class. A class is collections of objects of similar type.


o      We can create object of class using following syntax,


Syntax:   class-name object-name;


o      Here class name is class which is already created. Object name is any user define name. For example, if student is class,


Example: student s1, s2;


o      In example s1 and s2 are name of objects for class student. We can create any number of objects for class.

1 comment: