inheritance - constructor
Code:
class Vector2_1
{
protected:
double a, b;
public:
Vector2_1() {a=0; b=0;}
Vector2_1(double vec1, double vec2):a(vec1), b(vec2) {}
void SetSpecificValue(double value, int pos);
double GetSpecificValue(int pos) const;
virtual void print() {cout<<endl<<"["<<a<<" "<<b<<"]T"<<endl;}
};
class Vector1_2:public Vector2_1
{
public:
Vector1_2 operator * (const Matrix2_2&) const;
void print() {cout<<endl<<"["<<a<<" "<<b<<"]<<endl;} //The problematic line
};
Two problems:
1) For some reason it's like there is no inheritance between Vector1_2 from Vector2_1.
I can't write
Vector1_2 vec2(2,3);
It says there is no such overloaded function...
2) Adding the print() at the daughter class results in a large collection of errors, I guess from something related to the first point.
Thank you.