How to call class A's method from class B?
In your Java version, you define MainClass like this (my comments added):

public class MainClass{ // Define a new Class
    DoClass d;          // Add a member variable to the class
    public MainClass(){
        d = new DoClass(this); // Initialise the member variable
    } // MainClass()
} // MainClass


In your C++ you don't do the same thing - but you should! The class needs a DoClass member so that you can use it in other MainClass functions:

// MainClass.h
...
#include "DoClass.h" // Need the .h here - remove it from the .cpp
class MainClass
{
  public:
    MainClass();
    void setup();
    void loop();
    void printStuff();
  private:
    DoClass _d; // Create a private member variable to use
};


and

// MainClass.cpp
MainClass::MainClass() : // MainClass constructor (note colon)
           _d(*this) // Initialise member
{
} // MainClass::MainClass()


Now, you want DoClass to be able to use MainClass, so you passed it into DoClass's constructor. But DoClass cannot have a MainClass inside it - MainClass already has a DoClass inside it! Infinite impossibility! So you need DoClass to merely contain a reference to the MainClass that it sits inside. That's the C++ unary &amp; operator (different from the binary &amp; operator), which is used similar to the pointer * operator:

// DoClass.h
...
// Need to advise compiler MainClass exists...
// but can't #include MainClass.h! Infinite loop!
class MainClass;

class DoClass
{
public:
    DoClass(MainClass &amp;m); // Reference to MainClass
    void callMainClassFunct();
private:
    MainClass &amp;_m; // Reference to MainClass
};


and

// DoClass.cpp
DoClass::DoClass(MainClass &amp;m) : // DoClass constructor - note colon
         _m(m) // Initialise member variable
{
}