Home > Back-end >  Rookie ask questions about the kind of array
Rookie ask questions about the kind of array

Time:09-29


As shown in figure, I defined two classes, and defines the Studen in StudentCollection class array, but use is in the public section, the compiler hint of type is the error type

CodePudding user response:

Members behind the method with const, suggests that cannot modify the caller itself, nature will not be able to return to the caller members of const reference,
Remove the const behind the member method should go,

CodePudding user response:

Also have to consider how to deal with when you find them, or throw exceptions, or the return type is a pointer and don't use references,

CodePudding user response:

Error lies in mutual reference between the header files, cause of the problem of the chicken or the egg came first
Baidu forward declaration
  • Related