jrvbdeveloper
Member
- Joined
- Jul 15, 2007
- Messages
- 17
- Programming Experience
- Beginner
Hi,
I have a class inside a class. I need to expose the properties of the 2nd class to other classes, therefore it is public. However, I do not wish other classes to be able to create instances of this 2nd class, it should only be instantitated from its parent class. I thought I could resolve this issue by making the constructor of the 2nd class private, but this even prevents the parent class from instantiating its child class! How can I work around this, do I have to make the constructor public and allow anybody to create an instance of the class?
Thanks in advance!
I have a class inside a class. I need to expose the properties of the 2nd class to other classes, therefore it is public. However, I do not wish other classes to be able to create instances of this 2nd class, it should only be instantitated from its parent class. I thought I could resolve this issue by making the constructor of the 2nd class private, but this even prevents the parent class from instantiating its child class! How can I work around this, do I have to make the constructor public and allow anybody to create an instance of the class?
Thanks in advance!