Class method returns an enum declared in the class . (COMPILATION ERROR)
Solved
Language Bindings
-
Hi,
I have defined an enum inside a class. The I would want to implement a class method that returns a value of this enum.
I´m pretty sure that I am doing something incorrectly. Please , can you help me?(Code: simplifing a big class A)
class A : public B
{
Q_OBJECT
public:
enum DcConnectorIdx
{
DC_CONN_1,
DC_CONN_2,
DC_CONN_3,
DC_CONN_4,
DC_CONN_5,
DC_CONN_6,
DC_CONN_7,
DC_CONN_8
};
Q_ENUM(DcConnectorIdx)/* A lot of pubic methods not related to the problem...... */ protected: DcConnectorIdx getSatelliteId(SatelliteId satelliteId);
};
Issue rported by compiler is:
error: ‘DcConnectorIdx’ does not name a type 2258 | DcConnectorIdx A::getSatelliteId(SatelliteId satelliteId)
Thanks in advance !!!
-
In your cpp file, you need to add class name there:
A::DcConnectorIdx A::getSatelliteId(SatelliteId satelliteId) { // implementation }
-