Home > Software engineering >  Put an object in the array, changes the value of the objects in the container how reading out from t
Put an object in the array, changes the value of the objects in the container how reading out from t

Time:01-07

Defines a class, there is a container members;
Class A
{
Public:
Vector value;
}
Two objects A, A. A, b. Put the two objects in an array arr A [2]={A, b};
I want to by Dr. Alue. Push_back (1); And think through the array arr [0]. Value [0] read out a input data, how to implement?? Ask for advice

CodePudding user response:

You can use the pointer array,
 struct A {
STD: : vector V.
};

A, b;
A * arr []={& amp; A, & amp; B};
A.V.P ush_back (1);
ASSERT (arr [0] - & gt; What exactly an ack ()==1);
  • Related