Delete, Default and Delegating Constructors

If you using modern C++ in your programing life there are three important concepts in your life to manage methods.

If you compose a class without writing your own constructor (or copy constructor), The compiler creates a method for you to overcome basic structures. Of course, it does nothing but it is really necessary.

The thing about a scenario that you overwrite constructor method but this method takes a parameter, What happens if you did not present a constructor without parameter? Of course, the answer is the cosplayer don’t produce any constructor for you. So the default parameter cames here to help to say the compiler to generate a method for you. On the other hand, the delete keywords tells the compiler not to provide any peace of code for us for the method. Let see it in bellow.

In some cases, you do not prefer to implement all of the version of constructors because another version may overcome that problem. So the way is delegating the method to another.

Keep in mind, delegation works before your codes in the method.

Why nonstatic data initialization is important

Before Modern C++ approach (C++11) we initialized our class something like that.

But Modern C++ brings us this option.

Initializing by using simple curly brackets creates a method which runs before everything includes constructor methods, as a result, we don’t have to do anything for other alternative constructors.

Hello world!

After the long break, I decided to reopen my personal blog. I used to publish my codes (and the notes especially in Turkish) before. Now I move to the UK and publishing my notes in English is better chose.

Long waiting visas and especially job hunting. I am not completely sure how I will publish the same text in it but I am going to force myself.

By the way. As a programmer. Writing the same HelloWorld code in here is a must.