How can we restrict inheritance for a class?
How can we restrict inheritance for a class?
I various languages there are various syntax as below to restrict the inheritance of the class-
1. Java - It uses the final keyword.
Syntax -
public final class fdetails{
}
2. C# - It uses the sealed keyword.
Syntax -
public sealed class fdetails{
}
3.. VB.net - It uses the NotInheritable keyword.
Syntax -
public notinheritable class fdetails
end class
Server Management Company
India's Leading Managed Service Provider | Skype: techs24x7
Cpanel Technical Discussions - Lets talk !
There are 2 ways to stop or prevent inheritance in Java programming. By using final keyword with a class or by using a private constructor in a class.
█ Check out our new Online Email Validator @ Zero Bounce
█ Our unique email validation service eliminates high bounce rates.
|
Bookmarks