how to add a behaviour to modify details and display them in c++
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;
}
Comments
Leave a comment