Computer Science
Class and Object are inter-related. Justify this statement.
Objects & Classes
3 Likes
Answer
A Class is used to create various Objects that have different characteristics and common behaviours. Each object follows all the features defined within a class. Hence, class is also referred to as a blue print or prototype of an object.
Answered By
2 Likes
Related Questions
Give two differences between Polymorphism and Inheritance.
An object is referred to as an instance of a class. Explain.
Design a class 'AddDist' with the following specifications: class AddDist
Data members/Instance variables
int km, mts, cm
Member methods:
void getdist( ) : to accept a distance in km, mts and cm. void showdist( ) : to display the distance in km, mts and cm.
Write a main function to create an object of class 'Add_Dist' and call the member methods.Design a class 'Cuboid' with the following specifications:
class Cuboid
Data members/Instance variables
int len, br, ht, vol;
Member methods:
void input( ) : to accept length, breadth and height of a cuboid.
void calculate( ) : to calculate volume of a cuboid.
void display( ) : to print volume of cuboid.
Write a main function to create an object of class 'Volume' and call the member methods.