Why when a nested class and its inheritance from the class in which it is nested private variables are inherited? And also why if you remove inheritance ( : public baseclass ), then private variables continue to be displayed in intellisense, only I cannot use them? My main question is how to avoid this inheritance of private variables while I need nested classes?
#include <iostream> class baseclass { public: class derivedclass; private: int inn = 100; }; class baseclass::derivedclass : public baseclass { public: derivedclass() { std::cout << inn << std::endl; } }; int main() { baseclass::derivedclass first; system("pause"); return 0; }