I faced up a very strange error that I don't understand (using Visual Studio 2013). With the following example:
class a {
public:
a() = default;
};
class b : private a {
public:
b() = default;
};
class c : public b {
public:
c() = default;
a var; // ERROR C2247
};
I got following error:
error C2247: 'a' not accessible because 'b' uses 'private' to inherit from 'a'
The only way to get it compiled is to change the declaration of 'var' as following:
::a var;
I'm just curious to understand why do the compiler misinterpret the first declaration of 'var' ? what can it imagine ?