ICSE Class 9 Computer Applications Question 8 of 10

Elementary Concepts of Objects and Classes — Question 8

Back to all questions
8
Question

Question 8

How are classes and objects inter-related? Support your answer with an example.

Answer

A Class is used to create various Objects that have different attributes and common behaviours. Each object follows all the features defined within a class. That is why class is also referred to as a blue print or prototype of an object. For example, a class representing a car will have the following characteristics and behaviours:

AttributesBehaviours
ModelStart car
Registration NumberStop car
ColourApply break

We can create two objects of this class to represent a red i20 car and a white Baleno car as shown below:

AttributesBehavioursState
ModelStart carModel: i20
Registration NumberStop carRegistration Number: KA 01 AA 1234
ColourApply breakColour: Red
AttributesBehavioursState
ModelStart carModel: Baleno
Registration NumberStop carRegistration Number: WB 01 AZ 6789
ColourApply breakColour: White