Code:
//A.h class A { public: int quantity[8]; int m; } //B.h class B { public: void getquantity (); } //B.cpp void B::getquantity() { //how can I get access to quantity or any variables from A? when I try A::m- I get errors }
Printable View
Code:
//A.h class A { public: int quantity[8]; int m; } //B.h class B { public: void getquantity (); } //B.cpp void B::getquantity() { //how can I get access to quantity or any variables from A? when I try A::m- I get errors }
make m static,
get a private instance of A in B
use a singleton pattern
etc...
@JenniferF:
This is a symptom of bad design, since it breaks OOP principals.
It usually should not come to this with a correct design.
Lykurgs suggestions are correct, but the fact they need to be used is already the problem.
If you explain what it is you want to achieve, we probably can offer you better design approach.