Isn't it somehow an avoidable contradiction?
I mean,
Why do I want to this? Why did I declared myproperty private if I then create a public member function to change it?Code:class D {
private:
int myproperty;
public:
D(int mp=1):myproperty(mp){;}
void SetMyproperty(int setvar) {myproperty = setvar;}
};