H
Herby
Given class B and C which inherit from class A
They all override a method of the form:
Add( A^ lhs, A^ rhs ); So A is abstract.
So if i was defining Add for class B :
B::Add( A^ lhs, A^ rhs )
{
Value = ((B)lhs)->Value + ((B)rhs)->Value;
}
And the rhs argument happens to be of type C, although mostly it would
be of type B.
Instances of type C can legally be cast( converted ) to instances of
type B.
Given the argument is of type A, and the actual instance can be either
B or C.
How can i cast rhs to B?
I tried adding a virtual and concrete operatorB*() to A and C,
but made no difference?
Any ideas greatly appreciated?
They all override a method of the form:
Add( A^ lhs, A^ rhs ); So A is abstract.
So if i was defining Add for class B :
B::Add( A^ lhs, A^ rhs )
{
Value = ((B)lhs)->Value + ((B)rhs)->Value;
}
And the rhs argument happens to be of type C, although mostly it would
be of type B.
Instances of type C can legally be cast( converted ) to instances of
type B.
Given the argument is of type A, and the actual instance can be either
B or C.
How can i cast rhs to B?
I tried adding a virtual and concrete operatorB*() to A and C,
but made no difference?
Any ideas greatly appreciated?