C++ Programming - Objects and Classes - Discussion

Discussion Forum : Objects and Classes - General Questions (Q.No. 20)
20.
What does a class hierarchy depict?
It shows the relationships between the classes in the form of an organization chart.
It describes "has a" relationships.
It describes "kind of" relationships.
It shows the same relationship as a family tree.
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
9 comments Page 1 of 1.

Faizan said:   6 years ago
'"is a relationship" is also a "kind of relationship" = inheritance.

"has a relationship" is also a "part of relationship" = composition.

BalaG said:   9 years ago
Yeah @Dheeraj you are right. It is an example of HAS-A relationship and it is related to composition.

Angel said:   1 decade ago
In real life terms, bike and automobile depicts a 'kind-of relationship'.

Pankaj sharma said:   1 decade ago
Inheritance is categorized as "KIND OF" relationship in broad categorization.

Chithra said:   1 decade ago
Can anyone kindly give the exact definition of "kind of" relationships?

Dheeraj bajpai said:   1 decade ago
I think @Vimal is not right.

class Bike
{
Engine objEng;
};
class Engine
{
float CC;
};

Here class Bike contain the object of class Engine, so it is the ex. of composition ie has a relationship.

Vimal said:   1 decade ago
In has a relationship some members may take from another class.

In Kind of relationship all member are derive or take from another class. Because in hierarchical form some class is inherited so it derived all member but if in one class create another class object and use member of another class so it's a different things.

Kind of relationship example

class Bike
{
Engine objEng;
};
class Engine
{
float CC;
};

Java said:   1 decade ago
Also kindly explain what do you mean by "has a relationship " ?

Java said:   1 decade ago
What do you mean by "kind of relationships" ?

Post your comments here:

Your comments will be displayed after verification.