Use ctor-initializer rather than assignment for non-POD class members
This commit is contained in:
parent
691521e411
commit
af1cf0a5f3
10 changed files with 40 additions and 41 deletions
|
|
@ -20,27 +20,26 @@ class LifePattern
|
|||
{
|
||||
public:
|
||||
// This ctor is used by the LifeReader class
|
||||
LifePattern(wxString name,
|
||||
wxString description,
|
||||
wxString rules,
|
||||
wxArrayString shape)
|
||||
LifePattern(const wxString& name,
|
||||
const wxString& description,
|
||||
const wxString& rules,
|
||||
const wxArrayString& shape)
|
||||
: m_name(name)
|
||||
, m_description(description)
|
||||
, m_rules(rules)
|
||||
, m_shape(shape)
|
||||
{
|
||||
m_name = name;
|
||||
m_description = description;
|
||||
m_rules = rules;
|
||||
m_shape = shape;
|
||||
}
|
||||
|
||||
// A more convenient ctor for the built-in samples
|
||||
LifePattern(wxString name,
|
||||
wxString description,
|
||||
LifePattern(const wxString& name,
|
||||
const wxString& description,
|
||||
int width,
|
||||
int height,
|
||||
const char *shape)
|
||||
: m_name(name)
|
||||
, m_description(description)
|
||||
{
|
||||
m_name = name;
|
||||
m_description = description;
|
||||
m_rules = wxEmptyString;
|
||||
// TODO: add the positions later, since the formatting command
|
||||
// causes a crash due to conversion objects not being available
|
||||
// during initialisation.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue