P
Philipp Kraus
Hello,
I have got two pure virtual class like
class Base1 {
public :
virtual Base2 getReturn( void ) const = 0;
}
class Base2 {
public :
virtual void doSomething() = 0;
}
My implementated classes shows
class myReturn : public Base2 { .... }
class myObj : public Base1 {
public :
myObj() : m_data( myReturn() );
Base2 getReturn() { return m_data }
private :
myReturn m_data
}
On g++ I get an error "invalid initialization of reference of type". I would
like to return a reference or copy of the internal object and I need only, that
it is a derivated object from my pure virtual class.
How can I do this in a correct way?
Thanks for the explanation
Phil
I have got two pure virtual class like
class Base1 {
public :
virtual Base2 getReturn( void ) const = 0;
}
class Base2 {
public :
virtual void doSomething() = 0;
}
My implementated classes shows
class myReturn : public Base2 { .... }
class myObj : public Base1 {
public :
myObj() : m_data( myReturn() );
Base2 getReturn() { return m_data }
private :
myReturn m_data
}
On g++ I get an error "invalid initialization of reference of type". I would
like to return a reference or copy of the internal object and I need only, that
it is a derivated object from my pure virtual class.
How can I do this in a correct way?
Thanks for the explanation
Phil