Question #224816

how to add a behaviour to modify details and display them in c++


Expert's answer

Behaviors are used to modify the value of class member variables. Behaviors can be seen as the functions that can access the private members of a class.

For instance, the below class has a set function to initialize and get function to return the value of the variable.

class VariableInt{
private:
int x ;
public:
void setX(int x)
{ 
x = a;
}
int getA()
{
 return a; 
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS