Class and Objects
Why do we need Objects and Classes ?
For real time object we need real time data which can be created through Objects and Classes.
CLASS :
- Classes are used to create user-defined /real time data types.
-Syntaxically Class is a collection of member data and member function.
NOTE : member data is also called attributes and member function is also called methods.
- Class implements Data Abstraction and Data Encapsulation.
-Syntax of Class :-
<Acess Spcifier> Class< Class Name>{
//member data
//member function
}
OBJECTS :
- Instances of class.
-Stores data and invokes methods.
-Syntax of Object :-
<Class Name> <Object Name>=new <Class Name>();
No comments:
Post a Comment