I've really stuck on this error.
Here's the code:
file : Foo.h
Code:
#ifndef FOO
#define FOO
// class declaration
template <class T>
class Foo {
public:
Foo( void );
int foo( void ) const;
~Foo();
};
// class definition
template <class T>
Foo<T>::Foo( void )
{return;}
template <class T>
int Foo<T>::foo( void ) const
{return 0;}
template <class T>
Foo<T>::~Foo()
{return;}
#endif
file : Foo2.h
Code:
#include "Foo.h"
#ifndef FOO2
#define FOO2
// class declaration
template <class T>
class Foo2 {
public:
Foo2( void );
Foo<T> foo2( void ) const;
~Foo2();
};
// class definition
template <class T>
Foo2<T>::Foo2( void )
{return;}
template <class T>
Foo<T>
Foo2<T>::foo2( void ) const
{return Foo<T> f();}
template <class T>
Foo2<T>::~Foo2( void )
{return;}
#endif
and the main.cpp file:
Code:
#include "Foo.h"
#include "Foo2.h"
int main( void ) {
Foo2<int> foo2();
Foo<int> foo = foo2.foo2(); // expression error!!!!!!
return 0;
}
any help would be appreciated...