#135260 - LOst? - Sat Jul 21, 2007 3:38 pm
Hello, some trouble in template land.
I need to make a prototype of "int TestB::j" and void "TestB::g (void)" for use with TestA. Help! And I can't reverse TestA's and TestB's order. Note that both TestA and TestB are derived from TestBase, and are templates!
_________________
Exceptions are fun
I need to make a prototype of "int TestB::j" and void "TestB::g (void)" for use with TestA. Help! And I can't reverse TestA's and TestB's order. Note that both TestA and TestB are derived from TestBase, and are templates!
Code: |
// So far I know how to make a prototype of the class... But // I need prototypes for some members too. What to do? template <typename T, typename I> class TestB; template <typename T, typename I> class TestA : public TestBase <T, I> { public: int i; void f (TestBase* pTest) { ((TestB <T, I>*) pTest)->g (); // g function member is not defined in class TestB ((TestB <T, I>*) pTest)->j = 2; // j member is not defined in class TestB } }; template <typename T, typename I> class TestB : public TestBase <T, I> { public: int j; void g (void) { } }; |
_________________
Exceptions are fun