Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Derived Classes | OOP Essentials
C# Beyond Basics
course content

Зміст курсу

C# Beyond Basics

Derived Classes

When we say a class is derived from another class, it means that it has all the fields and methods of the parent class and in addition to it, the derived class can contain additional fields and methods as well.

The syntax for making an inherited class is the following:

cs

index

Here's an example with some concrete code:

cs

index

In this example, Dog is the derived class, inheriting from the Animal base class. The Dog class has access to the Name property and the Eat method from the Animal class. Additionally, it introduces a new method, Bark, which is specific to the Dog class.

As illustrated in the diagram, there can be cases where a class inherits from a class which is already a class from some other:

cs

index

In such a case, the class at the top-most level is called the Super Class. In this case Animal is the super class. Such a case where where there are multiple levels of inheritence is called Multi-Level Inheritence.

1. In C#, which keyword or symbol is used to declare a derived class?
2. In Multi-Level inheritance, what is the class at the top called?
3. Is Multilevel inheritance possible in C#?

In C#, which keyword or symbol is used to declare a derived class?

Виберіть правильну відповідь

In Multi-Level inheritance, what is the class at the top called?

Виберіть правильну відповідь

Is Multilevel inheritance possible in C#?

Виберіть правильну відповідь

Все було зрозуміло?

Секція 4. Розділ 1
We're sorry to hear that something went wrong. What happened?
some-alt