(b) Explain the following terms with example from C++ :
(1) Objects
(ii) Classes
Answers
Answered by
0
C++ Class
A class is a blueprint for the object.
We can think of a class as a sketch (prototype) of a house. It contains all the details about the floors, doors, windows, etc. Based on these descriptions we build the house. House is the object.
.
The variables length, breadth, and height declared inside the class are known as data members. And, the functions calculateArea() and calculateVolume() are known as member functions of a class.
C++ Objects
When a class is defined, only the specification for the object is defined; no memory or storage is allocated.
To use the data and access functions defined in the class, we need to create objects.
Similar questions
Computer Science,
2 months ago
Computer Science,
2 months ago
Computer Science,
4 months ago
English,
4 months ago
Chemistry,
11 months ago
Chemistry,
11 months ago
Math,
11 months ago