TheKedge
17th August 2006, 14:21
Hello all,
I can guess that the following warning it's not very important but how can I avoid it?
I derive a class from some base class. The compiler tells me that the copy constructor could not be generated for the base class. I get a similar second warning about the assignment operator.
The concrete example:
class SliderWidget :public QGroupBox
{
Q_OBJECT
public:
SliderWidget(Qt::Orientation orientation = Qt::Horizontal, QWidget * parent = 0 ):QGroupBox(parent)
{
// here I call new for some widgets and do the connect stuff
}
//there is no destructor defined
};
What would a copy constructor look like? Do I call new set all the member variables in the new instance and pass it back as the copy?
An assignement operator? Do I have to so the same as in the copy constructor?
thanks
K
I can guess that the following warning it's not very important but how can I avoid it?
I derive a class from some base class. The compiler tells me that the copy constructor could not be generated for the base class. I get a similar second warning about the assignment operator.
The concrete example:
class SliderWidget :public QGroupBox
{
Q_OBJECT
public:
SliderWidget(Qt::Orientation orientation = Qt::Horizontal, QWidget * parent = 0 ):QGroupBox(parent)
{
// here I call new for some widgets and do the connect stuff
}
//there is no destructor defined
};
What would a copy constructor look like? Do I call new set all the member variables in the new instance and pass it back as the copy?
An assignement operator? Do I have to so the same as in the copy constructor?
thanks
K