Hi,
I was wondering if there's s a clean way to do this:
- assume we have class A and B
- class B has a member 'SetThingie(const int pValue)'
- class A has a vector of class B
- class A has a 'current B' int
- class A has a member 'SetThingie(const int pValue)', same as class B
- when class A SetThingie is called, it should call SetThingie of the class B object in the vector, with index 'current B'
Now the most straigt forward you would be something like this:
class ClassA
{
public:
void SetThingie(const int pValue);
private:
int currentIndex;
std::vector<ClassB> mObjects;
}
class ClassB
{
public:
void SetThingie(const int pValue);
}
void ClassA::SetThingie(const int pValue)
{
mObjects[currentIndex].SetIndex(pValue);
}
Do you think there are easier/ cleaner ways to do this?