0

I am trying to create an array of objects with the class Sqr which is derived from Rect. But I am getting this error - undefined reference to `Sqr::Sqr()'. This is the code -

#include <iostream>

using namespace std;

class Rect
{
    float length, bredth;
public:
    Rect();
    Rect(float l, float b) : length(l), bredth(b){}
};

class Sqr : public Rect
{
public:
    Sqr();
    Sqr(float side) : Rect(side, side){}
};

int main(int argc, char const *argv[])
{

    Sqr ss[10];
    return 0;
}

0 Answers0