Start New Discussion within our Software Development Community

In Robot.h:

#include "Motores.h"
namespace SoftRobot {
...
public ref class Robot : public System::Windows::Forms::Form
    {
            ....
            public:
            void ComunicarEnviar(System::String^ EnvDados);

            private: System::Void Robot_Load(System::Object^  sender, System::EventArgs^  e) 

        {
            Motores ^newMDIChild = gcnew Motores();
            newMDIChild->MdiParent = this;
            newMDIChild->Show();
        }
};
}

In Global.cpp:

#include "Robot.h"
using namespace SoftRobot;
void Robot::ComunicarEnviar(System::String^ EnvDados)
{
   //send data
}

In Motore.h

namespace SoftRobot {
...
public ref class Motores : public System::Windows::Forms::Form
    {
    public:
        Motores(void)
        {
            InitializeComponent();
            //
            //TODO: Add the constructor code here
            //
        }
           ...
           void EnvMDEPwmL();
           private: System::Void Motores_Load(System::Object^  sender, System::EventArgs^  e)
        {
            Robot::ComunicarEnviar("dados");
        }
};
}

In Motores.cpp

#include "Motores.h"
using namespace SoftRobot;
void Motores::EnvMDEPwmL()
{
    //Execute motores
}

Can anyone help?
How can i use/call the function Robot::ComunicarEnviar("dados"); in Motores.h and how can i use/call the function EnvMDEPwmL() in Robot.h?

Thank you all.

Please use code tags. It really helps readability.

You'd have to have an instance of Robot in the Motores class in order to call that function.

This article has been dead for over six months. Start a new discussion instead.