|
-
January 9th, 2006, 10:09 AM
#1
Making a strong factory/prohibiting programmer use of NEW keyword
Hi guys..
I have a simple structure:
ObjParent is the base class from which my children inherit. I want a factory class that manufactures appropriate children and i dont want the programmer making his own children..
Dim x as ObjParent = FactoryClass.Manufacture("some influencing string")
Manufacture returns one of a number of child types ObjChildA, ObjChildB etc. I dont want the programmer to be able to make a New ObjParent or any New ObjChildX (where X varies)
how do i do this? I tried making the factory and the Parent/Children in the same namespace and making the constructors protected, but it doesnt work this way?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|