The two classes contain each other's members and are in the case of two files.

Source: Internet
Author: User

In an abstract summary, Class A is defined in Class A. H, and Class A has B * Members. Class B is defined in Class B. H, and Class B also has a * member.


The solution is to add class B and a line before class a definition to declare. Add # include "A. H" before class B definition (the exchange is the same)If Class A is added before class B;, it should not work., One by vc6ProgramVerification. It seems that a class cannot be found in the Class View.


In A. cpp, what if a function of Class A needs to call a function of Class B? In this case, the function is not defined. Add


Class B <br/>{< br/> Public: <br/> void fun (); // declare a function <br/> }; 

The declared Class B is to declare that Class B exists. You can use its type to define a member of Class.


Recently I went down to a document, but I did it in sequence, but I found similar errors, which is a kind of achievement.


I have supplemented it. However, the document itself lacks too much and cannot be completely supplemented. Hey hey...



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.