[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
template<> keyword - unexpected hide base typedefs
From: |
Grizlyk |
Subject: |
template<> keyword - unexpected hide base typedefs |
Date: |
11 Jan 2007 04:37:13 -0800 |
User-agent: |
G2/1.0 |
Hello.
Why were base class "typedefs" hidden by template<> and explicit usage
of them does not work too?
Try open only one of the lines in the example below
//using Tparent::Tptr;
//typedef Tparent::Tptr Tptr;
Consider example:
template< class A, class B> class Z;
template< class A, class B> class Ext1;
template< class A, class B>
class Base
{
public:
typedef Z<A,B> Tptr;
};
template< class A >
class Derived: public Base<A, Ext1<int,int> >
{
public:
typedef Base<A, Ext1<int,int> > Tparent;
using Tparent::Tptr;
typedef Tparent::Tptr Tptr;
inline void test(const Tptr obj)throw();
};
class Base2
{
public:
typedef Z<int,int> Tptr;
};
class Derived2: public Base2
{
public:
typedef Base2 Tparent;
using Tparent::Tptr;
//typedef Tparent::Tptr Tptr;
inline void test(const Tptr obj)throw();
};
/*
5.cpp:18: error: ISO C++ forbids declaration of 'Tptr' with no type
5.cpp:18: error: cannot declare member 'Base<A, Ext1<int, int> >::Tptr'
within 'Derived<A>'
5.cpp:18: error: expected ';' before 'Tptr'
5.cpp:20: error: expected ',' or '...' before 'obj'
5.cpp:20: error: ISO C++ forbids declaration of 'Tptr' with no type
*/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- template<> keyword - unexpected hide base typedefs,
Grizlyk <=