W
Wojtek Michalik
templete <class T>
class MyClass
{
private:
T member1;
T* member2;
template <class Type2>
class Embedded
{
T foo;
Type2 something;
};
public:
template <class AnotherType>
void function(AnotherType arg);
}
/* definition of member function template
template<class T> template <class AnotherType>
void MyClass< class T>::function(AnotherType arg)
{ /* do something */}
/* instantiation of it */
MyClass<int> example(constructor_args);
int a;
example.function( a );
/*
I found similiar but longer example in "C++ Primier" of Stanley B. Lippman
chapter 16.7. The book says nothing about instantiation an use of member template
<class Type2> class Embedded.
Can anybody give me an axample of use of such template ????
*/
class MyClass
{
private:
T member1;
T* member2;
template <class Type2>
class Embedded
{
T foo;
Type2 something;
};
public:
template <class AnotherType>
void function(AnotherType arg);
}
/* definition of member function template
template<class T> template <class AnotherType>
void MyClass< class T>::function(AnotherType arg)
{ /* do something */}
/* instantiation of it */
MyClass<int> example(constructor_args);
int a;
example.function( a );
/*
I found similiar but longer example in "C++ Primier" of Stanley B. Lippman
chapter 16.7. The book says nothing about instantiation an use of member template
<class Type2> class Embedded.
Can anybody give me an axample of use of such template ????
*/