Re: VB 6 -> C# Classes technical note...

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Dmitriy Lapshin [C# / .NET MVP] (x-code_at_no-spam-please.hotpop.com)
Date: 12/09/04


Date: Thu, 9 Dec 2004 10:44:24 +0200

Hello,

No, they are not equal. Public Not Creatable means that the class interface
is visible to the clients, but the clients cannot instantiate the class.
It's rather like a regular class with a private constructor in C#.
Speaking of factories, you can either make them fully static, or you can
implement the Singleton pattern - in which case there will be only one
static property returning the sole instance of the class, but the rest of
properties and methods will be non-static.

-- 
Sincerely,
Dmitriy Lapshin [C# / .NET MVP]
Bring the power of unit testing to the VS .NET IDE today!
http://www.x-unity.net/teststudio.aspx
"SpotNet" <SpotNet@msnews.grp> wrote in message 
news:%2301B7Ua3EHA.2788@TK2MSFTNGP15.phx.gbl...
>
> Hello NewsGroupies,
>
> Not a problem nor a show stopper, just want to ask whether a public not
> creatable class in VB6 equates to a class of static members in C# (or 
> static
> class in the new C# to come). Just built a whole lot of interface classes 
> in
> C# and want to allocate the interface to the appropriate implementation 
> via
> a 'factory' class, which in VB6 was done using a Public Not Creatable 
> class.
>
> I know it works using statics just asked for self clarification.
>
> Many thanks and Regards,
> SpotNet.
>
> 


Relevant Pages

  • Re: interface M
    ... foggy wrote: ... On one situation, it will instantiate A and B, on other ... > To interface M, a class X object will instantiate an object of M and then ... What do their clients need them for? ...
    (comp.lang.cpp)
  • Re: interface M
    ... "foggy" wrote: ... On one situation, it will instantiate A and B, on other ... To create an interface, you must know what the clients that use M need ...
    (comp.lang.cpp)
  • Re: iChat, one mans meat ...
    ... IM clients? ... I'd argue that iChat is a better user interface *for their target ... the chat colouring idea predates iChat by quite a long way. ...
    (uk.comp.sys.mac)
  • Re: Holub on getters/setters again
    ... > getter/setter interface, you simply can't implement that solution, so it ... code and how it uses the server methods, rather than focusing on how the ... Especially they might hint to clients implementing operations on ... whenever I modify the implementation of string (for example if I switch ...
    (comp.object)
  • Re: On getters/setters (to Daniel T.)
    ... >> code and how it uses the server methods, ... > might be reasonable to conclude that its clients are working on that data. ... I'm saying that changes to the interface of a class are (or at least ... to server code that would break client code. ...
    (comp.object)