Write 2 classes named Square and Cube.
The class Cube inherits the class Square.
The class Square has 2 integers attributes named x and y. It has one constructor that takes two integers and assigns them to x and y. Finally it has 1 method named computeArea the returns an integers after calculating the area of the square. The method fets no arguments.
The class Cube has one field which is a private integer named z. It has one constructor takes three integer arguments and calls its super-class constructor to assign x and y values, and then it assigns z value in its own constructor. Finally, it overrides the method computeArea.
using namespace std;
Square(int x1, int y1);
Square::Square(int x1, int y1)
x = x1;
return x * y;
class Cube: public Square
Cube(int z1,int x, int y):Square(x, y)
z = z1;
return Square::computeArea() * z;
int main(int argc, char *argv)
cout<<"Square's area: "<< square.computeArea();
cout<<"\nCube's area: "<< cube.computeArea();