O
Ole Olsen
I originally come from a VB6 background, now entirely programming in C#.
All in all a great language (C#) with a lot of powerful entities; there is however one thing that I just can't seem to figure out.
In VB6, when creating a Class, you can mark it at "PublicNotCreatable", meaning that it is not possible to instantiate it directly. This would one normally do, it you want to force people to access this concrete class through a defined Interface.
So you would write something like this in the Client app.
Dim myobject as IInterface
Set myobject = new myClass 'this is OK
if trying this approach:
Dim myobject as myClass
Set myobject = new myClass ' this wil FAIL
I think this is a quite nice feature, that you can force people to access your class via an Interface. Now - how do I accomplish this "shielding"/forcing in C#.NET?????
/Thanks!
/Ole
All in all a great language (C#) with a lot of powerful entities; there is however one thing that I just can't seem to figure out.
In VB6, when creating a Class, you can mark it at "PublicNotCreatable", meaning that it is not possible to instantiate it directly. This would one normally do, it you want to force people to access this concrete class through a defined Interface.
So you would write something like this in the Client app.
Dim myobject as IInterface
Set myobject = new myClass 'this is OK
if trying this approach:
Dim myobject as myClass
Set myobject = new myClass ' this wil FAIL
I think this is a quite nice feature, that you can force people to access your class via an Interface. Now - how do I accomplish this "shielding"/forcing in C#.NET?????
/Thanks!
/Ole