#include <bits/stdc++.h>
#include <iostream>
using namespace std;
class shape
{
public:
int width;
int height;
data(int w,int h){width=w;height=h;}
};
class Rectangle: public Shape
{
public:
int area ()
{
return (width * height);
}
};
class Triangle: public Shape
{
public:
int area ()
{
return (width * height / 2);
}
};
int main()
{
Rectangle rect;
Triangle tri;
rect.data(5,3);
tri.data(10,2);
cout<<rect.area()<<endl;
cout<<tri.area()<<endl;
return 0;
}
my code did not achive the inherting part and i am gitting erorr masseage that says "error: expected class-name before '{' token| "
the erorr in line ( class Rectangle: public Shape )
so what can i do to solve this?