We can stop the class from further inheriting by using the "Sealed" keyword.
For instance below is a simple sample code where we have a class called as
"Human" which is further inherited to create a "Male" or "Female" class.
Now the below code is great but we do not anyone to further inherit from "Male"
or "Female" class. In simple words "Male" and "Female" are the last legs in this
inheritance hierarchy. This can be done by using the "Sealed" keyword.
public class Human
public sealed class Male :
public sealed class Female : Human
If anyone tries to inherit the sealed classes he will end with the below
error "cannot derive from sealed type".
Above is the .NET
interview questions & also see the following video on circular dependency: -