In my C++ program, I want to create an object that has properties like width, height, area, etc. I also want to declare methods that use and update this properties.
I want the methods that "set" and "get" the propery "width" listed somehow in a header, namespace, or child class (anyway is possible) named WidthManipulator.
The reason I want to create my structure this way is I want to use "get" name for another method of another class, like HeightManipulator.
But for nested classes I get the "illegal call of non-static member function" error for Rectangle::WidthManipulator::Get(). I also don't want to create Manipulator objects as these classes don't have properties, just methods that are using and updating parent properties... One more thing, I want to use void returns for a good reason of my own.
class Rectangle{ public: int width,height; int area; int widthreturned; class WidthManipulator{ public: void Set(int x){width = x;} void Get(){widthreturned = width}; }; }; How can I approach to my problem ? What should be my structure ?