Code:class one { public: void test(two t) { } }; class two { public: void testt(one o) { } }; int main() { return 0; }
this gives the following error in visual c++ :
Code:(3)error C2061: syntax error : identifier 'two'
how do i fix such a thing.
This is a discussion on Classes within the C++ Programming forums, part of the General Programming Boards category; Code: class one { public: void test(two t) { } }; class two { public: void testt(one o) { } ...
Code:class one { public: void test(two t) { } }; class two { public: void testt(one o) { } }; int main() { return 0; }
this gives the following error in visual c++ :
Code:(3)error C2061: syntax error : identifier 'two'
how do i fix such a thing.
Forward declare the two class, and the define one::test outside of the class definition, e.g.,
Code:class two; class one { public: void test(two t); }; class two { public: void testt(one o) { } }; int main() { return 0; } void one::test(two t) { }
C + C++ Compiler: MinGW port of GCC
Version Control System: Bazaar
Look up a C++ Reference and learn How To Ask Questions The Smart Way
Thanks![]()