0

How a nested class works?

Classes and objects of c++

22nd Apr 2018, 4:54 PM
Aman Tiwari
Aman Tiwari - avatar
6 Answers
+ 11
A nested class is a member of its enclosing class. Non-static nested classes (inner classes) have access to other members of the enclosing class, even if they are declared private. Static nested classes do not have access to other members of the enclosing class.
22nd Apr 2018, 5:20 PM
Baraa AB
Baraa AB - avatar
0
Yes
22nd Apr 2018, 5:02 PM
Aman Tiwari
Aman Tiwari - avatar
0
Making a class inside class
22nd Apr 2018, 5:03 PM
Aman Tiwari
Aman Tiwari - avatar
0
If you create a class B inside a class A, then the only way you can access B is in A. Ex: class A { class B { ... }; B myVarB; // Here can access B }; // Here cannot access B
22nd Apr 2018, 5:06 PM
Bebida Roja
Bebida Roja - avatar
0
Thanks
22nd Apr 2018, 5:08 PM
Aman Tiwari
Aman Tiwari - avatar
- 1
You mean inheritance or making a class inside another class?
22nd Apr 2018, 5:01 PM
Bebida Roja
Bebida Roja - avatar