Inheritance in C#

Inheritance in coding allows us yo define a class based on a another class. This helps create and maintain an application easy. There are to types of classes; Base class and Derived class. The class where the properties are inherited is the derived class. The base class is where properties are inherited by another class. A base class can have multiple derived classes. Inheritance also allows us to reuse code without having to rewrite it. I also learned you cannot have multiple inheritance, but you can use interfaces to have multiple inheritances. I also got to learn more about the protected access modifier. Protected classes can only be accessible from derived classes. Sealed modifiers can prevent other classes from inheriting it or any of its members.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s