jeudi 7 février 2019

one class gives value secondary class object and third of them should show values object

I have 3 classes - first class gives value another class object, and i want showing or sent all of object created in secondary class to first class. What i should do ?

I apologize for my poor English maybe the code will tell you more about my problem.

// A.hpp
class A
{
  public:
    B *b;
};

// A.cpp
b->read();
std::cout << c[2].name; // How to show this data ?

// B.hpp
class B
{
  public:
    C *c;
    void read();
};
// B.cpp
B::read()
{
    c = new C[i];
    c[2].name = "ola";
}

// C.hpp
class C
{
  public:
    int name;
};

Aucun commentaire:

Enregistrer un commentaire