PublicNotCreatable instancing?

  • Thread starter Thread starter Larry Serflaten
  • Start date Start date
L

Larry Serflaten

I am getting a bit confused with several things that need doing,
but I am trying to grasp the concept of a few keywords.

The situation is I am making a DLL that uses two objects that
support the same interface. One should be creatable and the
other not. Due to the late hour I am perhaps not seeing things
as clearly as I should. ;-)

I am uncertain how to make one object creatable and the other
not. Do I create the hidden class as a Friend class with Friend
constructors, or should it be something else? Where does
'Protected' fit in?

The DLL is a second project in my solution and I am seeing the
hidden class in intellisense. I am thinking Friend isn't going to
do it, in a second project. It will still be available....

How do I make a PublicNotCreateable object, in this situation?

LFS
 
Larry,

In VB6 PublicNotCreatable was primarily used to create a public
interface. If that's what you want, just expose the interface and make
the implementing class Friend.

If you really want the class to be public but not creatable, make all
its constructors Private or Friend.



Mattias
 
Mattias Sjögren said:
Larry,

In VB6 PublicNotCreatable was primarily used to create a public
interface. If that's what you want, just expose the interface and make
the implementing class Friend.

If you really want the class to be public but not creatable, make all
its constructors Private or Friend.


Thanks, that is what I ended up doing. I had originally made just the
constructors Friend but the class was still showing in intellisense. Making
the class Friend removed it from the list, which is what I was looking
for...

LFS
 
Back
Top