Original Post
I''m playing around a bit with the windows API, and have created some helper-classes for dealing with the creation of windows.
Basically I have some classes looking like this:
So far, so good.
This works as they are supposed to, so I decided to create a class that had both regions and bitmaps.
So, I figured I''d do this:
Which gave me a whole bunch of error-messages.
Most of them dealing with the fact that the methods declared in WinMaker were now ambiguous, and that the constructor for SkinnedWinMaker was faulty.
I managed to fix the constructor-problem.
But I completely fail to see how the WinMaker methods are ambigous in SkinnedWinMaker, as they are non-virtual.
Anyways, in order to get somewhere I made them virtual in WinMaker, and explicitly overrode them in SkinnedWinmaker, which simply called BitmappedWinMaker or RegionedWinMaker''s similar methods, which got rid of all the error-messages, but was a serious hassle, and doesn''t seem right, somehow.
So, the question is, why does the compiler (VC++ 6.0, btw) feel that non-virtual methods in WinMaker are amiguated more than 2 subclasses down?
Does anyone know of any other useful way of getting the class-hierarchy done properly?
Oh, and also: After I got rid of all the damned compiler-errors I tried the class (SkinnedWinMaker), but although it was able to blit the bitmap on allright, it was unable to use regions.
-Neophyte
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GED d- s:+ a- C++$ UL++ P++ L++ E W+ N+ o K? w !O M--(+) V-- PS+
PE Y+ PGP t-- 5++ X+ R(+) rv+(++) b+++ DI+ D(+) G e+>++ h r--> y+
----- END GEEK CODE BLOCK-----
geekcode.com
class WinMaker {
public:
WinMaker (WinClass* winClass) : /* stuff */ { }
void AddStyle (DWORD s) { style |= s; }
/* Other methods */
void Create();
virtual void Paint (HDC hDC) { }
protected:
/* Member-data */
};
class BitmappedWinMaker : public WinMaker {
public:
/* BitmappedWinMaker is a windows-class that supports
blitting bitmaps to the window */
BitmappedWinMaker (WinClass* winClass) : WinMaker(winClass), /* other stuff */ { }
void LoadBitmapFromFile (const char* szFilename);
void Paint (HDC hDC) {
BitBlt (hDC, 0, 0, width, height, dcSkin, 0, 0, SRCCOPY);
}
protected:
HBITMAP hBitmap;
HDC dcSkin;
};
class RegionedWinMaker : public WinMaker {
public:
/* RegionedWinMaker has support for creating window-regions
for oddly shaped windows */
RegionedWinMaker (WinClass* winClass) : WinMaker(winClass), /* other stuff */ { }
void LoadRegionFromFile (const char* szFilename);
protected:
HRGN hRegion;
};
class SkinnedWinMaker : public BitmappedWinMaker, public RegionedWinMaker {
public:
SkinnedWinMaker (WinClass* winClass) : WinMaker(winClass) { }
};