Garmaine Staff asked 1 year ago

I was working with inheritance in C++ but I found the following error: 's' does not name a type.

Can someone please explain what is the problem?

#include<iostream>
using namespace std;
class a
{
public:
    int s,i;
    i=10;
};
class b:public a
{
public:
void print()
{
    cout<<s;
}
};
int main()
{
    b o;
    o.print();
}