Results 1 to 4 of 4
  1. #1
    Senior Member dennis123's Avatar
    Join Date
    Apr 2013
    Location
    Bangalore
    Posts
    3,627

    How can we restrict inheritance for a class?

    How can we restrict inheritance for a class?

  2. #2
    Registered User 24x7servermanag's Avatar
    Join Date
    Jul 2017
    Location
    India
    Posts
    1,020
    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 !

  3. #3
    Registered User
    Join Date
    Feb 2014
    Location
    delhi
    Posts
    572
    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.

  4. #4
    Member
    Join Date
    Nov 2017
    Posts
    37
    Quote Originally Posted by 24x7servermanag View Post
    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
    Best answer.
    Check out our new Online Email Validator @ Zero Bounce
    Our unique email validation service eliminates high bounce rates.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

  Find Web Hosting      
  Shared Web Hosting UNIX & Linux Web Hosting Windows Web Hosting Adult Web Hosting
  ASP ASP.NET Web Hosting Reseller Web Hosting VPS Web Hosting Managed Web Hosting
  Cloud Web Hosting Dedicated Server E-commerce Web Hosting Cheap Web Hosting


Premium Partners:


Visit forums.thewebhostbiz.com: to discuss the web hosting business, buy and sell websites and domain names, and discuss current web hosting tools and software.