A
Allen
Hi all,
I'm still having a hard time with my derived class. I know I make
reference to some MS-specific tech. but the question should be independent
of that; I'm having a hard time with the inheritance/classes. Here is what
I've got, paracoding for brevity:
//encapsulates the display and the DirectDraw COM object
class baseclass_DDraw
{
public:
baseclass_DDraw();
~baseclass_DDraw();
InitWindow(); //this is where m_hWnd is init'd
private:
friend class derrivedclass_MyDisplay;
HWND m_hWnd;
};
//encapsulates the DirectSound COM object
class baseclass_DSound
{
public:
baseclass_DSound(HWND hWnd); //needs to be the value created by
//baseclass_DDraw--THIS IS THE
PROBLEM!
~baseclass_DSound();
};
//extends the functionality of baseclass_DDraw, includes sound support from
//baseclass_DSound, and adds input support locally
class derrivedclass_MyDisplay : baseclass_DDraw
{
public:
derrivedclass_MyDisplay();
~derrivedclass_MyDisplay();
MyInputFunc();
private:
baseclass_DSound* privatepntr;
};
derrivedclass_MyDisplay()
{
InitWindow(); //m_hWnd is now init'd
privatepntr = new baseclass_DSound(m_hWnd);
}
Whew! The problem is that now I can't seem to expose the methods I need
from baseclass_DSound because it is private. I tried creating pointers to
the baseclass_DSound methods that I wanted exposed and then making those
pointers public members but, that gave me lots of weird errors.
I would be very grateful to anyone willing/able to help.
--
Best wishes,
Allen
No SPAM in my email !!
I'm still having a hard time with my derived class. I know I make
reference to some MS-specific tech. but the question should be independent
of that; I'm having a hard time with the inheritance/classes. Here is what
I've got, paracoding for brevity:
//encapsulates the display and the DirectDraw COM object
class baseclass_DDraw
{
public:
baseclass_DDraw();
~baseclass_DDraw();
InitWindow(); //this is where m_hWnd is init'd
private:
friend class derrivedclass_MyDisplay;
HWND m_hWnd;
};
//encapsulates the DirectSound COM object
class baseclass_DSound
{
public:
baseclass_DSound(HWND hWnd); //needs to be the value created by
//baseclass_DDraw--THIS IS THE
PROBLEM!
~baseclass_DSound();
};
//extends the functionality of baseclass_DDraw, includes sound support from
//baseclass_DSound, and adds input support locally
class derrivedclass_MyDisplay : baseclass_DDraw
{
public:
derrivedclass_MyDisplay();
~derrivedclass_MyDisplay();
MyInputFunc();
private:
baseclass_DSound* privatepntr;
};
derrivedclass_MyDisplay()
{
InitWindow(); //m_hWnd is now init'd
privatepntr = new baseclass_DSound(m_hWnd);
}
Whew! The problem is that now I can't seem to expose the methods I need
from baseclass_DSound because it is private. I tried creating pointers to
the baseclass_DSound methods that I wanted exposed and then making those
pointers public members but, that gave me lots of weird errors.
I would be very grateful to anyone willing/able to help.
--
Best wishes,
Allen
No SPAM in my email !!