C# Programming - Inheritance - Discussion

Discussion :: Inheritance - General Questions (Q.No.1)

1. 

Which of the following can be facilitated by the Inheritance mechanism?

  1. Use the existing functionality of base class.
  2. Overrride the existing functionality of base class.
  3. Implement new functionality in the derived class.
  4. Implement polymorphic behaviour.
  5. Implement containership.

[A]. 1, 2, 3
[B]. 3, 4
[C]. 2, 4, 5
[D]. 3, 5

Answer: Option A

Explanation:

No answer description available for this question.

Nasreen Khan said: (Aug 25, 2011)  
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: (Sep 17, 2011)  
Inherit means getting the property off.

Base class -> derived class.

Derived class has the features of base class and as its own.

Abhishek said: (Jan 11, 2012)  
Why is this "Implement polymorphic behaviour" is not included?

Rahul said: (Feb 2, 2012)  
It doesn't implement polymorphism. It just provides a way to implement polymorphism between methods.

Ravi Yadav said: (Mar 20, 2012)  
We can also implement polymorphism(Methodoverriding and methodhidding) behavior.

Md. Afroz Alam said: (Aug 1, 2012)  
Because in inheritance, a derived class inherit the feature of base class and functionality also there is no concept of polymorphism.

Chandra Shekhar said: (Aug 30, 2013)  
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: (May 6, 2014)  
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);

...
}

Jana said: (Aug 13, 2014)  
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.

Mahesh.Pola said: (Dec 18, 2014)  
In Inheritance derived class used the properties and methods defined in the Base class.

Vaithi said: (Oct 27, 2016)  
Yes, It's like a using already existing property from the parent class, add new property by child class which overrides the property too.

Tadewos said: (Jun 9, 2017)  
In Inheritance, derived class used the properties and methods defined in the Base class.

Samntha said: (Oct 6, 2017)  
Derived class can implement the methods and properties in the base class.

Post your comments here:

Name *:

Email   : (optional)

» Your comments will be displayed only after manual approval.