title: How to have a derived class object access values from the base class?
body: <p>So I am making this dumb project in C++ and whenever I call data members of the base class from the derived class, I am getting "undesired" values. Sorry for posting almost the entire code as I am not sure which parts  to avoid  :(</p>
  
  <pre><code>
  #include &lt;iostream&gt;
  
  using namespace std;
  class A
  {
     public:
      string a[10];
      int b[10];
      void setup()
      {
          a[1]="Hello world";
          b[1]=10;
  
      }
  
  };
  class B:public A
  {
      public:
      void test()
      {
          cout&lt;&lt;A::a[1];
          cout&lt;&lt;A::b[1];
      }
  };
  int main()
  {
      A obj;
      B obj2;
      obj.setup();
      obj2.test();
      return 0;
  }
  
  
  </code></pre>