0

I seem to have a basic bit of confusion about data access in a subclass. I have a parent class that contains a vector. I set up a child subclass that inherits from the parent class, but I cannot access the vector in the subclass?

#include <vector>

template <typename T>
class parentClass
{
 public:
  std::vector<T> teaList;
 };

template <typename T>
class childClass: public parentClass<T>
{
public:
  void echostuff(){cout <<"size "<<teaList.size()<<endl;}
};

using namespace std;
main()
{
  childClass<int> foo;
  foo.echostuff();
}

how would I access the list in the subclass?

0 Answers0