lundi 14 septembre 2020

Accessing one class member in another class [closed]

class A
{
 public:
    int m_count;
    int m_values[300];
    void Method1();
}
class B
{
    void Method2();
}

void A::Method1()
{
    for(int i=0; i<m_count; i++)
    {
        creates instances of class B
    }
}

B::Method2() needs m_values array of class A for each instances of class B. Here m_values get update every minute by another function in class A. Is it possible to access m_values of class A in all instances of class B?

Aucun commentaire:

Enregistrer un commentaire