Template inheritance

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



#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.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux