| | |
wierd template problem
Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Jan 2008
Posts: 119
Reputation:
Solved Threads: 10
take a look at this code:
when I try to compile with g++ i get:
test.cpp: In member function ‘void C<T>::B::write()’:
test.cpp:18: error: ‘x’ was not declared in this scope
If I remove the template argument of class C all workes fine ( of course )
Does anyone have an ideea of what is going on?
thx in advance
C++ Syntax (Toggle Plain Text)
template <class T> class C { public: class A { protected: int x; }; class B: public A { protected: void write() { cout << x << endl; } }; };
when I try to compile with g++ i get:
test.cpp: In member function ‘void C<T>::B::write()’:
test.cpp:18: error: ‘x’ was not declared in this scope
If I remove the template argument of class C all workes fine ( of course )
Does anyone have an ideea of what is going on?
thx in advance
![]() |
Similar Threads
- std::map and std::pair template problem (C++)
- Template problem - error status -1073741819 (C++)
- Class Template Problem - Constructor Issues - Please help (C++)
- wierd email problem (Windows NT / 2000 / XP)
- Wierd keyboard problem (USB Devices and other Peripherals)
- Dreamweaver MX2004 & date problem, etc. (Graphics and Multimedia)
- Wierd Login Problem (C#)
- PHP .tpl format template help! URGENT! (PHP)
Other Threads in the C++ Forum
- Previous Thread: enum with % (remainder) operator
- Next Thread: plz solve this
Views: 279 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for C++
6 api application array arrays based beginner binary c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete developer display dll dynamiccharacterarray email encryption error file format forms fstream function functions game generator givemetehcodez graph iamthwee ifstream image input int java lib list loop looping loops map math matrix memory multiple newbie news number numbertoword output pointer problem program programming project python random read recursion recursive reference return rpg search simple sort sorting string strings struct studio template templates text tree url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets






