Figure 2: Class Derived interface and implementation
/* ========================================== Derived.h ========================================== */ #ifndef DERIVED_H #define DERIVED_H #ifndef THREADABLEOBJECT_H #include "threadableobject.h" #endif class Derived : public ThreadableObject { public: Derived(); ~Derived(); void SetChar( char ch ); // Pure Virtual function in MultiThread virtual bool ThreadableTask(DWORD* dwReturnCode); private: char m_ch; int m_nCount; }; #endif /* ========================================== Derived.cpp ========================================== */ #include "derived.h" #include <iostream> Derived::Derived() :ThreadableObject() { m_ch = '\0'; m_nCount = 0; } Derived::~Derived() {} void Derived::SetChar(char ch) { m_ch = ch; } bool Derived::ThreadableTask( DWORD* dwReturnCode ) { using namespace std; while ( m_nCount < 100 ) { cout << m_ch; m_nCount++; // return true; } *dwReturnCode = 0; return false; }