Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Preventng direct creation of sub-class instances
Message
From
28/07/2006 09:33:57
 
 
To
All
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
Preventng direct creation of sub-class instances
Miscellaneous
Thread ID:
01141060
Message ID:
01141060
Views:
67
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
Next
Reply
Map
View

Click here to load this message in the networking platform