C++ Programming - Objects and Classes - Discussion
Discussion Forum : Objects and Classes - General Questions (Q.No. 20)
20.
What does a class hierarchy depict?
Discussion:
9 comments Page 1 of 1.
Java said:
1 decade ago
What do you mean by "kind of relationships" ?
Java said:
1 decade ago
Also kindly explain what do you mean by "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;
};
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;
};
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.
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.
Chithra said:
1 decade ago
Can anyone kindly give the exact definition of "kind of" relationships?
Pankaj sharma said:
1 decade ago
Inheritance is categorized as "KIND OF" relationship in broad categorization.
Angel said:
1 decade ago
In real life terms, bike and automobile depicts a 'kind-of relationship'.
BalaG said:
9 years ago
Yeah @Dheeraj you are right. It is an example of HAS-A relationship and it is related to composition.
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.
"has a relationship" is also a "part of relationship" = composition.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers