D
Dan =o\)
given this brief scenario, is this possible somehow?
class A
{
public SomeMethod()
{
}
}
class B : public A
{
public AnotherMethod()
{
}
}
class C : public A
{
public AnotherMethod()
{
}
}
then in my code to have some parameter:
void myMethod ( ref A MyAobj )
{
// do some stuff like calling SomeMethod()
}
finally, someone in my code I do this:
// ...
B MyBobj = new B();
C MyCobj = new C();
myMethod ( ref B );
myMethod ( ref C );
// ...
The compiler says firstly that the type "ref A" is
expected on "myMethod", so i changed it to this:
// ...
B MyBobj = new B();
C MyCobj = new C();
myMethod ( ref (A)B );
myMethod ( ref (A)C );
// ...
Of course this won't work on a reference, because an
lvalue is expected.
So is it possible to do what I'm trying to do?
Thanks.
Daniel.
class A
{
public SomeMethod()
{
}
}
class B : public A
{
public AnotherMethod()
{
}
}
class C : public A
{
public AnotherMethod()
{
}
}
then in my code to have some parameter:
void myMethod ( ref A MyAobj )
{
// do some stuff like calling SomeMethod()
}
finally, someone in my code I do this:
// ...
B MyBobj = new B();
C MyCobj = new C();
myMethod ( ref B );
myMethod ( ref C );
// ...
The compiler says firstly that the type "ref A" is
expected on "myMethod", so i changed it to this:
// ...
B MyBobj = new B();
C MyCobj = new C();
myMethod ( ref (A)B );
myMethod ( ref (A)C );
// ...
Of course this won't work on a reference, because an
lvalue is expected.
So is it possible to do what I'm trying to do?
Thanks.
Daniel.