mutable (C++)
Në shqip përdoret i njëjti emër.
ShpjegimiSQ
mutable lejon që një fushë të ndryshohet edhe brenda një metode const — p.sh. për një cache ose një numërues thirrjesh që s'e ndryshon „vlerën“ e vërtetë të objektit.
EnglishEN
mutable lets a field be changed even inside a const method — e.g. for a cache or a call counter that doesn't change the object's real “value”.
Si ta mendosh
Si shënimet me laps në librin e bibliotekës që lejohen: libri mbetet i njëjtë, por ti mban shënim sa herë e ke lexuar.
Lexoje në anglisht
Like pencil notes allowed in a library book: the book stays the same, but you keep track of how often you've read it.
Shembull kodicpp
class Fjalor {
mutable int kerkime = 0;
public:
int numero() const { return ++kerkime; }
};