| | |
wierd template problem
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
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
| Thread Tools | Search this Thread |
api application array arrays based beginner binary bitmap c++ c/c++ calculator char char* class classes coding compile compiler console conversion convert count data database delete desktop developer directshow dll dynamiccharacterarray email encryption error file forms fstream function functions game generator getline graph homeworkhelper iamthwee ifstream input int integer java lib linux list loop looping loops map math matrix memory multiple newbie news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference return rpg sorting string strings struct template templates text tree url vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






