1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Accessing private variables of a class

  1. Aug 6, 2010 #1
    how can i access the private variables of a class from another class?

    for example...
    Code (Text):

    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
    }
     
     
  2. jcsd
  3. Aug 6, 2010 #2

    Borek

    User Avatar

    Staff: Mentor

  4. Aug 6, 2010 #3
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook