better examples for passing values for safety

Address comments from #37
This commit is contained in:
Jason Turner
2015-08-24 16:15:05 -06:00
parent bf0a81c718
commit d3a6edba2e

View File

@@ -9,18 +9,8 @@
class MyClass
{
public:
MyClass(std::string t_value)
: m_value(t_value)
{
}
std::string get_value()
{
return m_value;
}
private:
std::string m_value;
void do_something(int i);
void do_something(std::string str);
};
@@ -28,19 +18,10 @@ private:
class MyClass
{
public:
MyClass(const std::string &t_value)
: m_value(t_value)
{
}
std::string get_value() const
{
return m_value;
}
private:
std::string m_value;
void do_something(const int i);
void do_something(const std::string &str);
};
```
### Consider Return By Value for Mutable Data, `const &` for Immutable