Getters and setters

if i cout the price in setprice function,then i do not need getprice function.Then what is the importance of getters.

hey @RULEREMPIRES, getter is just a name given to a function which gives the value of some variable. There is nothing special about this.if you cout the price in setprice function, than it will be called getter as well.
Want to know more about this. Consider this link http://www.zeuscmd.com/tutorials/cplusplus/50-GettersAndSetters.php

1 Like

hey @RULEREMPIRES, please mark this doubt as resolved.