Can classes have another class in them? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

Can classes have another class in them?

27th Jul 2018, 1:29 AM
Surath Singh
Surath Singh - avatar
3 Answers
+ 9
Yes, in C++ you can, it is called a nested class. However, this class is more like an extension of it's containing class, so don't forget that the sub class can access it's containing class members even if they are private.
5th Sep 2018, 10:15 AM
Byk
+ 3
Thanks a lot!!! and scarlet special thanks for the example
27th Jul 2018, 1:13 PM
Surath Singh
Surath Singh - avatar
0
in python also call it inner class i make an example https://code.sololearn.com/cSFNOjvtnN6S
27th Jul 2018, 12:25 PM
Flandre Scarlet
Flandre Scarlet - avatar