Home > OS >  Class template inheritance compile problem
Class template inheritance compile problem

Time:10-13

#include
#include

TemplateClass B
{
Public:
Struct _Node {
int x;
};

Int buf [_Size];
};

TemplateClass A: public B<_Size & gt;
{
Public:
typedef B<_Size & gt; _Base;

using _Node=_Base: : _Node;

Typename B<_Size & gt; : : _Node * node;
};


Int main ()
{
A<10 & gt; a;
A.n ode=0;

return 0;
}

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
The above code on centos 7 with g + + compiler, tip error: error: expected type specifiers, errors point to the red mark along the line _Base
This code is normally compile on Windows platforms, but under Linux tip can't find the _Base this type declaration (typedef seems doesn't work on one line), which master can guide, be obliged!

  • Related