[C/C++] Simple example of using 'typename'

Language/C&C++ 2008.04.22 23:38
[[ blog 이사 과정에서 정확한 posting날짜가 분실됨. 년도와 분기 정도는 맞지 않을까? ]]

We can use 'typename' in template class.

template
class C
{
    typename T::bT* a;
}

But, keyword 'typename' cannot be used outside template. So, following is incorrect syntax.

class A;
class B
{
    A*     a;
    typename A::bT* b; // error here!
};

So, in this case, class A's definition should be included before definition of class B.

It's just small information about using 'typename'.

신고
tags : ,
Trackback 0 : Comment 0

티스토리 툴바