I
InV4in
Hello,
I have an abstract base class looking something like this:
class AlgebraicValue
{
public:
const char deftype;
AlgebraicValue( void )
: deftype( 0 ) { }
virtual AlgebraicValue* foo( AlgebraicValue const& ) = 0;
}
and a derived class Fraction looking like:
class Fraction : AlgebraicValue
{
public:
Fraction( int, int );
Fraction* foo( AlgebraicValue const& );
}
with a constructor
Fraction::Fraction( int a = 0, int b = 1 )
: deftype( 1 )
{
// bla bla
}
But g++ -Wall -pedantic says: "class 'Fraction' does not have any
field named 'deftype'" so I tried writing AlgebraicValue::deftype in
the constructor of Fraction, but then it said "class 'AlgebraicValue'
does not have any field named 'deftype'". After that I was totally
confused.
I would really appreciate anyone helping me to resolve this problem.
Best regards.
I have an abstract base class looking something like this:
class AlgebraicValue
{
public:
const char deftype;
AlgebraicValue( void )
: deftype( 0 ) { }
virtual AlgebraicValue* foo( AlgebraicValue const& ) = 0;
}
and a derived class Fraction looking like:
class Fraction : AlgebraicValue
{
public:
Fraction( int, int );
Fraction* foo( AlgebraicValue const& );
}
with a constructor
Fraction::Fraction( int a = 0, int b = 1 )
: deftype( 1 )
{
// bla bla
}
But g++ -Wall -pedantic says: "class 'Fraction' does not have any
field named 'deftype'" so I tried writing AlgebraicValue::deftype in
the constructor of Fraction, but then it said "class 'AlgebraicValue'
does not have any field named 'deftype'". After that I was totally
confused.
I would really appreciate anyone helping me to resolve this problem.
Best regards.