C++11 – defaulted function

C++11 introduced the defaulted function as the following example.

class help
    help() = default;
    std::string m_text;

The main reason of this feature is to compromise the case which if user define another non default constructor, complier will not generate the default constructor automatically. Sometime this is very annoying for writer so if you use the defaulted function as shown above example, user can easily generate default constructor automatically.

This entry was posted in C++, Programming. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s