I read several posts about Nested classes in our community and beyond, and I'm pretty confused.
As far as I understand, in C ++, nested classes are no different from separate / independent classes.
While I was trying to better understand conecpt, I wrote simple code and I found out that the inner class can access the outer class without getting friendship from the outer class.
For example:
class Outer { private :
You can see that the Inner class, which is nested in the Outer class, has access to its data members (Outer class), and Lonesome, as an independent class, cannot access the data element of the Outer class.
I apologize if this is a duplicate or a stupid question, but I just want to confirm with you that there is a difference between a Nested class and an independent class (two different classes that have no internal / external relationship).
Thanks everyone, Syndicator =]
c ++
Syndicatorbbb
source share