"Moonlit" <news moonlit xs4all nl> schrieb im Newsbeitrag
news:41***********************@news.xs4all.nl...
Hi,
I suppose you want to do this and set Crayons color also from
ColorfullPens (I also assume the Crayon in the function should be
Crayons ),.
class CColor{};
class ColorfulPens
{
CColor Color;
public:
const CColor& GetColor() const { return Color; }
void SetColor( const CColor& Color ) { this->Color = Color; }
};
class Crayons : public ColorfulPens
{
public:
void SetMeTheColorOf(const ColorfulPens& Pen )
{
SetColor( Pen.GetColor(); }
}
};
Now, make
class WaxCrayon:public ColorFulPens
{
public:
void SetMeTheColorOf(const ColorfulPens& Pen)
{
// now please cast Pen to type: WaxCrayon to access other
member functions
}
};
I'll explain my situation in detail, so it might give a better
approach:
I have a parser class that converts:
a=3+3/6
to:
3
a=3+-
6
In ASCII. Now I want to do the same using e.g. GDI drawings, for nicer
displaying of roots e.g.
The class ASCIIblock has these methods:
void Set(const char* singleline);
void InsertAt(long x, long y, const ASCIIblock& block_to_paste);
void MakeDivision(const ASCIIblock& divident, const ASCIIblock&
divisor);
....
The parser class has a function:
template class <DRAWblock>bool EvaluateGFX(DRAWblock& out)
{
...
DRAWblock block1, block2;
block2.Set(someline);
block1.InsertAt(0,0, block2);
...
}
and get's called with:
ASCIIblock ab;
MyClass.EvaluateGFX(ab);
But I need a class that has these functions:
class GDIblock
{
public:
void Set(const char* singleline);
void InsertAt(long x, long y, const GDIblock& block_to_paste);
void MakeDivision(const GDIblock& divident, const GDIblock&
divisor);
};
....er... wait... that's working isn't it? I have to re-think about my
problem myself now... (If it still exists)
-Gernot