C# Inheritance Interview Questions and Answers - 2

Question: 6

What are characteristics of Inheritance?

Abstract classes cannot be inherited.

Sealed classes cannot be inherited.

A derived class extends its direct base class. It can add new members to the derived class.

Constructors and destructors are not inherited.

A derived class can hide an inherited member.

A derived class can override an inherited member.

Question: 7

What are the characteristics of abstract class?

It cannot be instantiated directly.

It can have abstract members.

We cannot apply a sealed modifier.

Question: 8

What is the use of base keyword?

A subclass constructor is used to construct the instance variables of both the derived class and the base class.

The subclass constructor uses the keyword base to invoke the constructor method of the super class.

Question: 9

When you inherit a protected class-level variable, who is it available to?

Classes in the same namespace.

Question: 10

Give the restrictions of new modifier?

A member declaration with a new modifier hides an inherited member only with in the scope of the new member.

A member declaration with a new modifier cannot include override keyword in its declaration.

It is an error to include both new and override modifier in the same declaration.

Related Questions