Re[2]: [Dev-C++] templates and inheritance
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Astar <As...@tu...> - 2003-04-29 20:57:14
|
Hello Ioannis,
IV> This code compiles. Find the differences. :)
IV> template <class T, int optimum>
IV> class CConteiner
IV> {
IV> };
IV> class CScene{};
IV> class CScenes:public CConteiner<CScene*, 4>
IV> {
IV> };
IV> int main()
IV> {
IV> }
:)))) very interesting... of course i have main-function (my project
consist of ~40-45 files and i thought that writing about my
main-function (and other parts of project) is unnecessary)
i find problem (it isn't absence of main-function :)).
I have problem with writing implementation of methods
(constructor/destructor too) in two files. I mean, if i write it only
in .h file:
template <class T, int o>
class CConteiner{
CConteiner(){....}
~CConteiner(){....};
};
it's OK!(compiling and linking) ....... but if i write implementation
of constructor/destructor in .cpp file i have link error. I write:
template <class T, int o>
CConteiner<T, optimum>::CConteiner(){
.......
}
template <class T, int o>
CConteiner<T, optimum>::~CConteiner(){
.......
}
what's wrong with my code???
or may be i must write body of methods in declaration?
PS. sorry for my english :)
--
Best regards,
Astar mailto:As...@tu...
|