473,397 Members | 2,099 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

PublicNotCreatable instancing?

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


Nov 20 '05 #1
3 4126
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 [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 20 '05 #2

"Mattias Sjögren" <ma********************@mvps.org> wrote
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

Nov 20 '05 #3

"Mattias Sjögren" <ma********************@mvps.org> wrote
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

Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: KyleC | last post by:
Disclaimer: I'm fully aware that the following is not the proper way to do things, and that one should never, ever create objects in Session scope, but it's all I've got to work with until the next...
0
by: Sean | last post by:
Hello, I have the following scenario. I hope someone may help me on this: I have an ASP.NET web-application that create .xml files according to a defined schema and they are sent out to our...
15
by: Carlos Lozano | last post by:
Hi, What is the right way to create an OCX COM component. The component is already registerred, but can't create an instance. I am using the reference to the interop module created. If I use...
5
by: Scott H | last post by:
Hi All, Coming from VB6, there was a bit of a difference in the way you display a form, I Thought I'd nailed instanciating a form, but I'm quite stuck with something that doesn't make sense. ...
4
by: Lee Gillie | last post by:
What I am hoping to do is make a constructor for a derived class that can accept an instance of the base class. Maybe this just is not possible? I am working with the new SSLStream in the 2005...
2
by: Marcus Schaefer | last post by:
Hello, I have a queer problem in my project (Visual Basic Express 2005): When I create a new Instance of one of my classes dim data as new CData(fname) <-- crash ! Dim frm as new...
47
by: Max | last post by:
Due to the behaviour of a particular COM object, I need to ensure that a request for a particular ASP page is finalized before another request for the page is processed. Does IIS have a way to...
2
by: Chicken15 | last post by:
Hi Group. First of all I'm sorry for asking (maybe) such easy questions. But I'm quite stuck now and couldn't come up with a solution by using my C# book or googling. So it would be nice if...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.