I've got the following class:
class BaseStyle {
private:
Style *style;
public:
BaseStyle(Style& theStyle);
const Style& getStyle() const;
void setStyle(const Style& theStyle);
};
I'm trying to store the reference passed in the constructor in style
, and change that property when setStyle()
is called. I expected to be able to have a property Style& style
, however, then I read c++ reference properties can not be changed after initialization. Now I think it's best to store the reference in a pointer, but how do I do that? I can't just do style = theStyle
, right?