In the C + + course of the semester, the teacher left three major projects and some small homework, these projects for me is very meaningful,
It is a pleasure to constantly improve the programming ability in the process of completing the homework, every homework has a lot of small problems,
Either there is a problem with the compilation, either a dead loop occurs directly after the program runs, or because the pointer problem program is all out of the card, you need to
Every possible error in the program before and after the test output to see where the program is wrong, so it is very important to learn how to test, it is often possible to do more with less.
What is particularly profound is that in the process of completing an implementation of the JSON entity class in C + +, we have encountered the challenge of calling each other class, and have spent a certain amount of time.
(JSON entity class object and value class value, array class, the approximate variable definition declaration of the class is array:vector<value>; Value:int, Double,array; Object:map<string,value>)
At first, the job was to implement three classes in a. cpp file and found that there was a problem after writing the various function declarations for the class (because the class calls each other so
Compile error is the value class is not declared such as), try to search the solution on the Internet, and then combine the understanding of C + + class, so find a solution, in the program's most
Before starting the implementation of the class, add three simple declarations class Array, class Object, Class Value, and the program is finally compiled.
And then due to the need for program normalization, I took three classes to separate the write, so for each class is defined by the. cpp and. h files, in these files the mutual invocation of the class
has become a very difficult problem, according to the previous experience in a CPP, I first in each class of. h file added to remove the class of the other need to call the class
statement, and then follow the previous experience, such as adding the header file include "Array.h" to the Array.cpp, to find that the compilation does not pass, and finally in Array.cpp
Add the. h file of the class that needs to be called, and the final compilation passes.
Software Test Job 1--problems and solutions to the mutual invocation of classes in C + + projects