2 ms·
Good point - by dwelling on variables, I failed respond to the article on the precise topic. Now I'll illustrate const methods and parameters as per your sugges
by nayuki 7y ago
Good point - by dwelling on variables, I failed respond to the article on the precise topic. Now I'll illustrate const methods and parameters as per your suggestion.
Rust:
fn reads_myself(&self) { ... }
fn writes_myself(&mut self) { ... }
fn reads_arg(w: &Widget) { ... }
fn writes_arg(w: &mut Widget) { ... }
C++:
void readsMyself() const { ... }
void writesMyself() { ... }
void readsArg(const Widget &w) { ... }
void writesArg(Widget &w) { ... }