class A{ private: std::vector<class X> flavor1 std::vector<class X> flavor2 public: void useVectorOfX(std::vector<class X> someflavor){ ...
Now I want to call useVectorOfX() from another class, giving it either flavor1 or flavor2 depending on the need. I can think of three ways -
Method 1: use Getter methods; but for class A it seems unnatural to get its own data through the Getter method.
class B{ public: A *a = new A(); a->useVectorOfX(a->getFlavor1()); }
Method 2: Make two vectors public (dirty)
Method 3: Separate methods?
class B{ public: A *a = new A(); a->useVectorOfXForFlavor1(); a->useVectorOfXForFlavor2(); }
source share