Passing Struct to a class by reference

0

Good afternoon, guys.

I'm learning how to program in C ++ and I use the Qt framework for it. I get an error compiling as below:

  

../ RWCXML / frmMainWindow.cpp: In member function 'void clsMainWindow :: fcMontarDadosXml ()':   ../RWCXML/frmMainWindow.cpp:388:67: error: no matching function for call to 'clsTeste :: fcSaveDBXmlCompanyDBXml (clsMainWindow :: stcCompanyName &)'            vobjTesteDBXml- > fcSaveDBXmlCompanyDBXml (stcCadCompany);                                                                      ^   In file included from ../RWCXML/frmMainWindow.h:6:06,                    from ../RWCXML/frmMainWindow.cpp:1:   ../RWCXML/clstest.h:29:10: note: candidate: void clsTest :: fcSaveDBXmlCompanyDBXml (clsTest :: stcDomainDBXml &)        void fcSaveCompanyDBXml (stcCadastroCompanyDBXml & pstcCadEmpresaDBXml);             ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~   ../RWCXML/clstest.h:29:10: note: no known conversion for argument 1 from 'clsMainWindow :: stcCadastroEmpresa' to 'clsTeste :: stcCadastroEmpresaDBXml &'

The base class code is:

clsteste.h

class clsTeste : public QWidget

{     Q_OBJECT public:     explicit clsTest (QWidget * parent = nullptr);

struct stcCadastroEmpresaDBXml
{
    // DADOS DO DOCUMENTO XML
    QStringList vstrDadosDocXml;

    //TABELA EMPRESAS ( Principal )
    QStringList vstrDadosEmpresas;

    //TABELA SOCIOS, REPRESENTANTES, ADVOGADOS. ( Secundarias )
    QStringList vstrDadosSocios;
    QStringList vstrDadosAdvogados;
    QStringList vstrDadosRepresentantes;
};

void fcSalvarCadastroEmpresaDBXml(stcCadastroEmpresaDBXml  &pstcCadEmpresaDBXml);

clsteste.cpp

void clsTeste::fcSalvarCadastroEmpresaDBXml(stcCadastroEmpresaDBXml &pstcCadEmpresaDBXml){
stcCadastroEmpresaDBXml stcTest;
stcTest=pstcCadEmpresaDBXml;}

frmMainWindows.cpp

    clsTeste *vobjTesteDBXml = new clsTeste();
    vobjTesteDBXml->fcSalvarCadastroEmpresaDBXml(stcCadEmpresa);

The struct stcCadEmpresa is equal to struct stcCadastroEmpresaDBXml. It's the one I want to go by reference.

Someone could help me.

Thank you in advance.

    
asked by anonymous 09.05.2018 / 21:42

0 answers