Im new to c++, I'm trying to have a class that has a method that take an instance of it self. Here what I'm try to achieve.
Class A {
public:
std::vector<int>* getData(){return &data;}
// I need to merge the data from 2 class, so in my code
//I can call p.merge(c) where p&c instance of A
void Merge (A ptr) {
data = ptr->getData()->data;
}
private:
std::vector<int> data;
}
Any idea how to do the merge function.
Aucun commentaire:
Enregistrer un commentaire