Hi
The second common warning is the following.
Quote: |
warning: 'class CbmFieldMap' has pointer data members
warning: but does not override 'CbmFieldMap(const CbmFieldMap&)'
warning: or 'operator=(const CbmFieldMap&)'
|
The problem here is that both functions are automatically created by the compiler if the are not declared. If the class has pointer data members one should explicetly define what both
functions should do with this pointers. If neither of the both functions are needed the solution of the problem is quite simple. If one needs the functions it get complicated (not discussed in this topic).
All of the automatically generated functions are public and can be accessed by everybody. If you declare both functions as private but don't implement them the problem is solved. The compiler will not generate the functions automatically and since the functions are private nobody can use them.
If now any of the two functions is called from another class there will be a compiletime error because the function is declared private.
If the functions are called from other functions of the same class or functions of a friend class there will be no compiletime but a linktime error. So in any case it will not be possible to use any of the two functions.
Add the following part to the header file.
private:
CbmFieldMap(const CbmFieldMap&);
CbmFieldMap operator=(const CbmFieldMap&);
Thats it.