Accessing private variables of a class

  • Thread starter Thread starter magnifik
  • Start date Start date
  • Tags Tags
    Class Variables
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
2 replies · 2K views
magnifik
Messages
350
Reaction score
0
how can i access the private variables of a class from another class?

for example...
Code:
class One{
  public:
     One();
  private:
     int array[6][7]    
};

class Two{
  public:
     Two();
  private:
     void printNumbers();
};

void Two::printNumbers(){
     // i want to access the array in class One here
}
 
Physics news on Phys.org