answersLogoWhite

0

Objects and classes is a feature of C++ which allow code reusability. A class is a blueprint of all the functions and variables some thing like a blueprint for a car. however like you cannot drive the blueprint of a car you drive the car. Similarly objects and derived from the class and are used in the code

eg

class rep {

private : int somevar;

public: showvar()

{

cout<<somevar;

}

};

int main()

{

rep C1;

c1.somevar()=27;

c1.showvar();

return 0;

}

In this code "rep" is the class and "c1" is the object and somvar is a variable defined for rep and used by c1;

User Avatar

Wiki User

∙ 15y ago
User Avatar

What else can I help you with?