Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CPP-1,2 header and code separation problem #2

Open
JimJeon opened this issue May 12, 2016 · 2 comments
Open

CPP-1,2 header and code separation problem #2

JimJeon opened this issue May 12, 2016 · 2 comments

Comments

@JimJeon
Copy link
Owner

JimJeon commented May 12, 2016

I need to separate code from header files.
And http://www.cplusplus.com/forum/articles/10627/ read this!

@JimJeon JimJeon added this to the in May milestone May 12, 2016
@JimJeon JimJeon added the to me label May 12, 2016
@JimJeon
Copy link
Owner Author

JimJeon commented May 12, 2016

  • add CPP-2 practice makefile
  • CPP-2 assignment error occurs

@taeguk
Copy link

taeguk commented May 17, 2016

Good. And Using initializing list when initialize member variables in constructor is more better thand initializing in constructor body(means inside { ... } ).

class Bad {
    Data data;
public:
    Bad(const Data& data) { this->data = data; }
};
class Good {
    Data data;
public:
    Good(const Data& data) : data(data) { }
};

Bad constructor calls Data::Data() and Data::operator=(const Data& data).
Good constructor calls Data::Data(const Data& data).

JimJeon pushed a commit that referenced this issue May 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants