C# Programming - Inheritance - Discussion
Discussion Forum : Inheritance - General Questions (Q.No. 1)
1.
Which of the following can be facilitated by the Inheritance mechanism?
- Use the existing functionality of base class.
- Overrride the existing functionality of base class.
- Implement new functionality in the derived class.
- Implement polymorphic behaviour.
- Implement containership.
Discussion:
13 comments Page 1 of 2.
Nasreen Khan said:
1 decade ago
It is correct as inheritance is the mechanism of deriving a new class from the base class, thus we can excess the functionality of base class in derived class.
P.vijayan said:
1 decade ago
Inherit means getting the property off.
Base class -> derived class.
Derived class has the features of base class and as its own.
Base class -> derived class.
Derived class has the features of base class and as its own.
Abhishek said:
1 decade ago
Why is this "Implement polymorphic behaviour" is not included?
Rahul said:
1 decade ago
It doesn't implement polymorphism. It just provides a way to implement polymorphism between methods.
Ravi yadav said:
1 decade ago
We can also implement polymorphism(Methodoverriding and methodhidding) behavior.
Md. Afroz Alam said:
1 decade ago
Because in inheritance, a derived class inherit the feature of base class and functionality also there is no concept of polymorphism.
Chandra Shekhar said:
1 decade ago
Polymorphism is a concept that tells us how to change the behavior of a method not a pre defined method or keyword.
Nicholas Mahbouby said:
1 decade ago
Rahu: "It doesn't implement polymorphism. It just provides a way to implement polymorphism between methods".
The question says:
"Which of the following can be facilitated by the Inheritance mechanism?".
"4. Implement polymorphic behavior"
Facilitate means to assist, make easier or less difficult. Inheritance does assist the implementation of polymorphic behavior.
In the below example, animal could be an Elephant, a Lion or anything that inherits from the base class class Animal. All inherit the Eat method and thus can be used Polymorphically through the base class.
foreach(Animal animal in zoo)
{
animal.Eat(food);
...
}
The question says:
"Which of the following can be facilitated by the Inheritance mechanism?".
"4. Implement polymorphic behavior"
Facilitate means to assist, make easier or less difficult. Inheritance does assist the implementation of polymorphic behavior.
In the below example, animal could be an Elephant, a Lion or anything that inherits from the base class class Animal. All inherit the Eat method and thus can be used Polymorphically through the base class.
foreach(Animal animal in zoo)
{
animal.Eat(food);
...
}
Jana said:
1 decade ago
Inheritance means you can implement the properties and methods of parent(Base) class into Child (derived) class.
And you can implement new functionality in child(derived) class as you want.
And you can implement new functionality in child(derived) class as you want.
Mahesh.Pola said:
10 years ago
In Inheritance derived class used the properties and methods defined in the Base class.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers