C# object class help

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • PCH

    #1

    C# object class help

    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.


  • Pent

    #2
    Re: C# object class help

    You want: microsoft.publi c.dotnet.langua ges.csharp

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

    "PCH" <pch12@hotmail. com> wrote in message
    news:%23tY5qtsq DHA.1872@TK2MSF TNGP09.phx.gbl. ..[color=blue]
    > 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[/color]
    used[color=blue]
    > 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[/color]
    just[color=blue]
    > 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.
    >
    >[/color]


    Comment

    Working...