hello everyone,
My doubt is related to access specifier.
There is one code snippet -
class Base
{
public:
explicit Base();
static int object_count;
protected:
int id;
};
class child: public Base
{
public:
child(int val) : id(object_count++){}
};
This code is giving compilation error that id is not the member of child class
id is protected so child class can access it as its own member but why it is giving error.
Can anyone please answer to my query?