Inheritance
is the ability of an object oriented language (C# in this context) to
build new class definitions based on existing class definitions.
Inheritance allows us to extend the behavior of a base (parent)
class by inheriting core functionality into the derived subclass
(child class). Inheritance promotes code re-usability.
Inheritance
preserves encapsulation – private members of the base class can
never be accessed from an object reference of the derived class.
Private members can only be accessed by the class that defines
it.
C#
does not support Multiple Inheritance. A class in C# cannot directly
derive from two or more base classes.
No comments:
Post a Comment