Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Preventng direct creation of sub-class instances
Message
De
28/07/2006 09:48:41
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
28/07/2006 09:33:57
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01141060
Message ID:
01141071
Vues:
21
>Hi,
>
>I tried using:
>
>  public class BaseObject
>    {
>        private BaseObject() { }
>    }
>
>to prevent other developers directly creating an instance of the class. I was hoping to sub-class from this and have the behaviour inherited by these classes. Seems that's not possible - in fact I can't sub-class from BaseObject at all because 'BaseObject is inaccessible due to it's protection level'. Any other way to achieve what I need (I don't like the idea of having to put private constructors in all the leaf classes)
>
>Regards,
>Viv

Viv,
Wouldn't 'protected' in base do what you want?
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform