Singleton class issue in Qt
Posted
by sijith
on Stack Overflow
See other posts from Stack Overflow
or by sijith
Published on 2010-05-25T07:26:33Z
Indexed on
2010/05/25
7:31 UTC
Read the original article
Hit count: 317
i created a singleton class and trying to access that class in other class but getting error "cannot access private member"
Setupconfig is my singleton class and i am trying to access this class in other class which have QMainWindow
Error 'Setupconfig::Setupconfig' : cannot access private member declared in class 'Setupconfig'
/////////////////////////////////////////////////////////////////////
Setupconfig.h
static Setupconfig *buiderObj()
{
static Setupconfig *_setupObj= new Setupconfig();
return _setupObj;
}
private:
Setupconfig();
//////////////////////////////////////
EasyBudget.h
class EasyBudget : public QMainWindow, public Ui::EasyBudgetClass, public Setupconfig
{
Q_OBJECT
public:
Setupconfig *setupObj;
}
//////////////////////////////////////
EasyBudget.cpp
EasyBudget::EasyBudget(QWidget *parent, Qt::WFlags flags)
: QMainWindow(parent,Qt::FramelessWindowHint)
{
setupObj=Setupconfig::buiderObj();
}
© Stack Overflow or respective owner