Quick A: Yes.
Recently on SO:
Idiomatic way to declare C++ immutable classes
So I have some pretty extensive functional code where the main data type is immutable structs/classes. The way I have been declaring immutability is "practically immutable" by making member variables and any methods const.
struct RockSolid { const float x; const float y; float MakeHarderConcrete() const { return x + y; } }Is this actually the way "we should do it" in C++? Or is there a better way?
Add a Comment
Comments are closed.