Without much delay, here is the code that I don’t know why it does what it does:
Well, he creates this conclusion:
A.print() called A.print() called A.print() called A.print() called
But why?
Background
First, I started my journey through the rabbit hole when I encountered a problem that I had to deal with friend s. Therefore, I am reading a friend's declaration, not declaring ahead (and the answers mentioned here and here ). Therefore, trying to create a simple example (the result of which you see above), I found that I really do not need a friend at all.
Question
So, here is the main question: Why does the A::B instance have access to the private function A A::print() ? (although I understand that I could misunderstand that my children are children, unlike the basic or received ones)
c ++ class instance parent-child
hcc23 Feb 07 '13 at 19:01 2013-02-07 19:01
source share