Create a class named 'Shape' with a method to print "This is This is shape". Then create two other classes named 'Rectangle', 'Circle' inheriting the Shape class, both having a method to print "This is rectangular shape" and "This is circular shape" respectively. Create a subclass 'Square' of 'Rectangle' having a method to print "Square is a rectangle". Now call the method of 'Shape' and 'Rectangle' class by the object of 'Square' class.


Create a class named 'Shape' with a method to print "This is This is shape". Then create two other classes named 'Rectangle', 'Circle' inheriting the Shape class, both having a method to print "This is rectangular shape" and "This is circular shape" respectively. Create a subclass 'Square' of 'Rectangle' having a method to print "Square is a rectangle". Now call the method of 'Shape' and 'Rectangle' class by the object of 'Square' class.








#include <iostream>
using namespace std;

class shape{
public:
shape()
{
cout<<"\t This is Shape"<<endl;
}
};
class rectangle :public shape{
public:
rectangle()
{
cout<<"\t This is rectangular shape"<<endl;
}
};
class square :public rectangle{
public:
square()
{
cout<<"\t Square is a rectangle"<<endl;
}
};
class circle :public shape{
public:
circle()
{
cout<<"\t This is circular shape"<<endl;
}
};
int main()
{
square s;
}


Create a class named 'Shape' with a method to print "This is This is shape". Then create two other classes named 'Rectangle', 'Circle' inheriting the Shape class, both having a method to print "This is rectangular shape" and "This is circular shape" respectively. Create a subclass 'Square' of 'Rectangle' having a method to print "Square is a rectangle". Now call the method of 'Shape' and 'Rectangle' class by the object of 'Square' class.