CLASSES in C++
Classes are data structures clubbing together data and associated functions together.
Class declaration
FORMAT :-
class class_name
{
access-specifier:
data and functions
access-specifier:
data and function
...
...
access-specifier:
data and function
} object-list;
C++ allows the declaration and definition of classes. Instances of classes are called object. In above declaration, class is a keyword. Access specifier may be public,private and protected, which decides scope and visibility of data members and member functions declared in the class definition . Thus class is said to be user-defined data type . So implementation of the same class varies from user to user. Following example illustrates the class definition including its members.
Class declaration
FORMAT :-
class class_name
{
access-specifier:
data and functions
access-specifier:
data and function
...
...
access-specifier:
data and function
} object-list;
C++ allows the declaration and definition of classes. Instances of classes are called object. In above declaration, class is a keyword. Access specifier may be public,private and protected, which decides scope and visibility of data members and member functions declared in the class definition . Thus class is said to be user-defined data type . So implementation of the same class varies from user to user. Following example illustrates the class definition including its members.
Comments
Post a Comment