Home > Back-end >  Put a container as a private member variables should be how to initialize the class?
Put a container as a private member variables should be how to initialize the class?

Time:01-06

A private member variables of a class, I know that can be written as float this type of void Set_max (float Max) this function to read and write operations on data in the object, but the vector The value of the function should be how to write? To know a great god gives directions ~ ~
Private:
Vector The value;
The float min;

CodePudding user response:

 void Set_value (vector Value) 
{this - & gt; Value=https://bbs.csdn.net/topics/value}

emmm... This is ok? Is really a function parameter is different, or you can
 void Add_value (float a) 
{this - & gt; Value. The push_back (a)}

CodePudding user response:

reference 1/f, a white steamed bun response:
 void Set_value (vector Value) 
{this - & gt; Value=https://bbs.csdn.net/topics/value}

emmm... This is ok? Is really a function parameter is different, or you can
 void Add_value (float a) 
{this - & gt; Value. The push_back (a)}

Above that way I can't, I tried an error, I just want to know how to input and read the value of the object container according to the static function

CodePudding user response:

refer to the second floor yym86202 response:
Quote: reference 1/f, a white steamed bun response:
 void Set_value (vector Value) 
{this - & gt; Value=https://bbs.csdn.net/topics/value}

emmm... This is ok? Is really a function parameter is different, or you can
 void Add_value (float a) 
{this - & gt; Value. The push_back (a)}

Above that way I can't, I tried an error, I just want to know how to input and read the value of the object container according to the static function

emmm... These two functions are set into a class member function, attribute is Public,

CodePudding user response:

references a white steamed bread reply: 3/f
Quote: refer to the second floor yym86202 response:
Quote: reference 1/f, a white steamed bun response:
 void Set_value (vector Value) 
{this - & gt; Value=https://bbs.csdn.net/topics/value}

emmm... This is ok? Is really a function parameter is different, or you can
 void Add_value (float a) 
{this - & gt; Value. The push_back (a)}

Above that way I can't, I tried an error, I just want to know how to input and read the value of the object container according to the static function

emmm... These two functions is to set up into a class member function, attribute is Public,
already write two function member function, initialization is can't do that, if the Public type without write function, can operate directly, but inside the object could not initialize the pubic type, I call in an array has the problem, so have to get into private, object initialization ~ ~ after operation
  • Related