[Solved] when passing non member variable data to a constructor how to save them and use then in other member functions ? C++ [closed]


Your two options are

1) Make them member variables

2) Add them as arguments to the print() function, as shown below, then call print within the constructor (if that is the intention)

void CPOI::print(string name, double latitude , double longitude)

If you pass them to the constructor, but they are not stored in member variables, and not used as parameters for any functions called in the constructor, they are effectively useless.

1

solved when passing non member variable data to a constructor how to save them and use then in other member functions ? C++ [closed]