| | |
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
Failure is not fatal, but failure to change might be. - John Wooden
![]() |
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 array arrays based beginner binary bitmap c++ c/c++ calculator char char* class code coding compile compiler console conversion count data database delete deploy developer dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game getline givemetehcodez graph gui homeworkhelp homeworkhelper iamthwee ifstream input int java lib linker list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference rpg sorting string strings temperature template test text text-file tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






