C++ - Accessing a variable in another class

Hello,

I'm trying to access a public variable declared in another class,
and making a mess of it.
Help Please!

Regards
 
error: cannot declare variable 'graphicview' to be of abstract type 'calledclass'/
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
called class

#include "callingclass.h"

calledclass::calledclass{QWidget* parent, Qt::WindowFlags f)
    :QWidget(parent, f)
	,eventHandler{new RS_EventHandler{this}}
	,gridColor(Qt::gray)
	,metaGridColor{64, 64, 64}
	,grid{new RS_Grid{this}}
	,drawingMode(RS2::ModeFull)
	,savedViews(16)
    ,previousViewTime(QDateTime::currentDateTime())
    ,panning(false)
{
    RS_SETTINGS->beginGroup("Colors");
    setBackground(QColor(RS_SETTINGS->readEntry("/background", Colors::background)));
    RS_SETTINGS->endGroup();
    //*** ***
    dialogOptionsSkip = true; //used in callingclass.cpp
    //*** ***
}
1
2
3
4
5
6
callingclass.cpp

class calledclass; // Forward declaration

	calledclass graphicview; //error here
    qDebug() << "dialogOptionsSkip" << graphicview.dialogOptionsSkip;
Last edited on
It seems calledclass is a base abstract class.
Is there any pure virtual function inside it?
You can’t have any instance of a base abstract class.
Hello Enoizat,

Thanks for the explanation.
I've resorted to plan 'B' and got something working.

Regards
Topic archived. No new replies allowed.