I have a class, suppose a.cpp. In the private property of this class, I have a pointer to b.cpp and c.cpp where b.cpp is the implementation of a virtual interface class, lets call d.cpp. Also, in the private property of c.cpp, I have a pointer to the interface class, d.cpp.
I want to access one of the methods of class a.cpp in b.cpp class. How can I do that?
The example can be ok, let me give some methods in the classes
class A{
private:
B *_classB;
C *_classC;
public:
int add(int, int);
}
Now, the interface class is D So, in class D, we have
class D{
public:
virtual int mul(int, int) = 0;
}
Now, the class B is the implementation of interface class D So, B looks like:
class B{
private:
int first_num;
int second_num;
public:
virtual int mul(int a, int b);
}
and class C also has pointer to the interface class, so C looks like
class C{
private:
D *_classD;
}
Now, I want to call the method int add(int, int) in class B.