|
-
October 23rd, 2004, 03:29 AM
#1
copy construct
HI!
I need to realize a didactic application, with a CFigure base class and 4 derivate classes: CLine, CTriangle, CCircle and CRectable.
The base clase (CFigure has 2 private special attributes:
CPen m_LineColor;
CBrush m_FillColor and the derivated classes acccess it throught public metods.
But, I have problems to the Set and Get methods of this classes.
CPen CFigure::GetLineColor()
{
EXTLOGPEN extlogpen;
m_LineColor.GetExtLogPen( &extlogpen );
return m_LineColor; //!!! Error HERE
}
Error: C2558: class Pen no copy constructor available
I build 2 constructors, a simple constructor and one with parameters.
CFigure::CFigure()
{
m_strFigName = _T("");
m_iX1 = 0;
m_iY1 = 0;
EXTLOGPEN extlogpen;
CPen line_col;
line_col.GetExtLogPen( &extlogpen );
LOGBRUSH LogBrush = { extlogpen.elpBrushStyle, extlogpen.elpColor, extlogpen.elpHatch };
m_LineColor.CreatePen( extlogpen.elpPenStyle, extlogpen.elpWidth, &LogBrush );
LOGBRUSH logbrush;
CBrush fill_col;
fill_col.GetLogBrush( &logbrush );
m_FillColor.CreateBrushIndirect(&logbrush);
}
CFigure::CFigure(int coordX, int coordY, CPen& line_col, CBrush& fill_col, CString figName)
{
m_strFigName = figName;
m_iX1 = coordX;
m_iY1 = coordY;
EXTLOGPEN extlogpen;
line_col.GetExtLogPen( &extlogpen );
LOGBRUSH LogBrush = { extlogpen.elpBrushStyle, extlogpen.elpColor, extlogpen.elpHatch };
m_LineColor.CreatePen( extlogpen.elpPenStyle, extlogpen.elpWidth, &LogBrush );
LOGBRUSH logbrush;
fill_col.GetLogBrush( &logbrush );
m_FillColor.CreateBrushIndirect(&logbrush);
}
CFigure::~CFigure()
{
m_LineColor.DeleteObject();
m_FillColor.DeleteObject();
}
What can I do to access this base class atribute (ex. m_LineColor)?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|