Template inheritance

icegood icegood1980@gmail.com
Thu Jun 28 10:20:00 GMT 2012


#include <cstddef>
#include <new>
#include <iostream>
#include <cstdlib>

class Base
{
public:
  Base(){FBase=123;}
protected:
  int FBase;
};

template<typename T>
class A : public Base
{
public:
  A(){}
  T FA;
};

template<typename T>
class B : public A<T>
{
public:
  B(){}
  T FB;
  virtual void F() {std::cout <<FBase << std::endl;} // fails here
  inline void SetB(int vB) {FB=vB;}
};

int main()
{
  B<int> VB;
  //
  VB.F();
}

- doesn't compile. A<T>::FBase  instead of FBase solves isuue. Could it be
somehow easier, because have
~100 properties in Base class each of them called 100 times in B.
-- 
View this message in context: http://old.nabble.com/Template-inheritance-tp34085480p34085480.html
Sent from the gcc - Help mailing list archive at Nabble.com.



More information about the Gcc-help mailing list