21.
class Engine
{
}
class Car
{
Enine e;
}
class CarTest
{
public static void main()
{
Car c = new Car();
c.Engine = new Engine();
}
}
The relationship between the Car and the Engine can be described as
View Description
Composition - Functionality of an object is made up of an aggregate of different classes. In practice, this means holding a pointer to another class to which work is deferred.
Inheritance - Functionality of an object is made up of it's own functionality plus functionality from its parent classes.
Car and Engine do not inherit.