djwilliams 0 Posted November 25, 2007 Report Share Posted November 25, 2007 Hi I have been trying to get the following to work class TimerInterrupt: public Interrupts { public: }; class Timer { public: friend class TimerInterrupt; //A friend class Timer(void); int GetCount(void) { return Count;} private: class TimerInterrupt* InterruptPtr; int Count; }; Are friend classes supported? Also how are forward declarations declared? // forward declarations class Timer; class UART; class DUART; The class declaration will attempt to construct the objects if this syntax is used, how do you work round this? or is it not supported? Many thanks Dave Quote Link to post Share on other sites
Pavel 0 Posted December 13, 2007 Report Share Posted December 13, 2007 Forward declaration is now supported starting from 6.82 Regards, Pavel Quote Link to post Share on other sites
djwilliams 0 Posted December 17, 2007 Author Report Share Posted December 17, 2007 Hi Pavel I have declared the Timer class at the top of the file like so // forward declarations class Timer; class Interrupts { .................. } class TimerInterrupt: public Interrupts { public: TimerInterrupt(Timer* ownerptr){ InterruptOwnerPtr = ownerptr; Reg(TIMER_INTERRUPT_NUMBER, this); } TimerInterrupt(int i){ } virtual void ISR(int intNumber); private: class Timer* InterruptOwnerPtr; }; class Timer { //friend class TimerInterrupt; public: Timer(void); //ERROR missing RIGHT BRACE int GetCount(void) { return Count;} private: TimerInterrupt* InterruptPtr; int Count; }; and the above error at the Timer(void) constructor keeps appearing. If I get rid of the code that requires the forward timer declaration and the Timer forward declaration then it compiles okay Many thanks Dave Quote Link to post Share on other sites
Pavel 0 Posted December 18, 2007 Report Share Posted December 18, 2007 Looks like compiler problem. We work on a fix. Regards, Pavel Quote Link to post Share on other sites
Pavel 0 Posted February 8, 2008 Report Share Posted February 8, 2008 Looks like compiler problem. We work on a fix. Now fixed. Regards, Pavel Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.