lundi 17 avril 2017

Correct declarations for multiple inheritance?

With C++11 enabled in the compiler I have implemented a global class that inherits from 4 other ones like this :

Global view

For this I've declared the classes like this :

ProjectMatrix.cpp:

ProjectMatrix::ProjectMatrix(const QString MName="Matrix Name",const quint16 MCols=8 ,const quint16 MRows=8, const quint16 MColors=3 ):
    MathMatrix(MName,MCols , MRows,  MColors ),Pattern(),SequenceManager(),ConfigurationManager()
{}

ProjectMatrix.h:

#ifndef PROJECTMATRIX_H
#define PROJECTMATRIX_H

#include "matrix.h"
#include "configurationmanager.h"
#include "sequencemanager.h"
#include "pattern.h"

class ProjectMatrix: public MathMatrix,public Pattern,public SequenceManager,public ConfigurationManager
{
public:
    ProjectMatrix(const QString MName,const quint16 MCols,const quint16 MRows, const quint16 MColors );

};

#endif // PROJECTMATRIX_H

The main problem is when I need to access MathMatrix data from

configurationManager.cpp:

bool ConfigurationManager::SaveToFile(const QString InifileName)
{
settings.setValue( "Name" , QString( ProjectMatrix::MName) );
return true ;
}

This ends with :

configurationmanager.cpp:45: error : invalid use of non-static data member 'MathMatrix::Name' settings.setValue( "Name" , QString( ProjectMatrix::Name) );

Aucun commentaire:

Enregistrer un commentaire