Problem printing values from a class.

 
//+------------------------------------------------------------------+
//|                                      Copyright 2020, Anonymous3. |
//|                                                254loop@gmail.com |
//+------------------------------------------------------------------+
class CBase
    {
public:
                     CBase(void)
         {
          value = rand();
         };
                    ~CBase(void) {};
     //---
     int             value;
    };
//---
class CClass
    {
public:
                     CClass(void) {};
                    ~CClass(void) {};
     //---
     void            function(CBase *value)
         {
          Print(value);
         }
    };
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnStart()
    {
     CBase *m_base = new CBase();
     CClass *m_class = new CClass();
//---
        //*** would like to use m_class.function(___) to print m_base value here. 
//---
     delete m_base;
     delete m_class;
    }
//+------------------------------------------------------------------+

Hello there. I started with the code so it'd be easier to explain the problem. 

As illustrated above, I'd like to print the value in CBase class called value, using the CClass but cannot figure out how. 

I've tried this:

m_class.function(m_base.value);

//&&
int some_variable = m_base.value;
m_class.function(some_variable);

... and a whole bunch of other methods but I don't seem to be getting anywhere. I really need some help here. 

Thanks in advance.

 
class A {
 public:
   int value;
   A(): value(rand()) {}
};

class B {
 public:
   void func(A &other) {
      Print(other.value);
   }
};

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnStart() {
   A a;
   B b;
   b.func(a);
}
 
nicholi shen:

This is a completely different approach. I'd like it if you provided an explanation on it. See, I'm using a neural network library and it's classes take the form I posted above. Are the two methods different or the style used?

I'm thinking, you somehow coded the value variable to be assigned a value when the constructor is called. I don't clearly understand how that is getting done, and how this part 

A a;
   B b;
   b.func(a);

gets the value to be printed. 

Can this be done when more than one variable in the A class need to be accessed? 

Reason: