B
Brian Withun
I have a base class (B) and several derived classes (D1, D2, ...)
I have a container class (C) with an attribute (void *d) which is
intended to point to any of D1, D2,...
My question is, on my C::GetObject() accessor, what is the most
appropriate return type?
void* C::GetObject( void ) { return d; }
or
B* C::GetD( void ) { return (B*) d; }
Is there any galvanizing rationale as to why I'd choose one return
type over the other, or is there yet another possibility I have not
considered?
TIA
Brian Herbert Withun
I have a container class (C) with an attribute (void *d) which is
intended to point to any of D1, D2,...
My question is, on my C::GetObject() accessor, what is the most
appropriate return type?
void* C::GetObject( void ) { return d; }
or
B* C::GetD( void ) { return (B*) d; }
Is there any galvanizing rationale as to why I'd choose one return
type over the other, or is there yet another possibility I have not
considered?
TIA
Brian Herbert Withun