C# object class help

  • Thread starter Thread starter PCH
  • Start date Start date
P

PCH

Hello all,

I want to setup a program that will have several similar classes that with
have identitcal properties.

Im my main procedure I want to only declare 1 basic object that can be used
for any of the classes.

such as:

object oObj;

oObj = new oClass1();

the problem is I cant reference any of the new objects properties.

such as:

oObj.MyProp();

I think this is because the original declaration of the oObj object is just
a standard object, and it has no definitions you can use.

is there a way to allow it to use the correct class calls.. such as
oObj(MyProp), etc etc?

Thanks.
 
You want: microsoft.public.dotnet.languages.csharp

oClass1 c1 = (oClass1)oObj;
c1.MyProp();
 
Back
Top