Nothing.
when we must using default keyword?
When you want to compiler creates that for you, some situations like when you explicitly defined a constructor with parameters, but you want to have the default constructor as well.
I said 'when you want to compiler creates that for you', how do you expect the compiler know that how to deal with the constructor parameter?
= default can be applied only for those constructors that can be automatically generated (default constructor, copy constructor, move constructor) Also to destructor and assignment operators (afaik).
I believe that Scott Mayer explained default very well in Effective Modern C++ items, but i can't find it.
ok what difference between this two
Again, Nothing. In the second one you just explicitly ask the compiler to generate the default constructor for you.
What resource do you follow for learning C++ programming?
google and telegram
Oh, why? why not just The C++ Programming Language by Bjarne Stroustrup? or if you don't know enough about programming: https://www.stroustrup.com/programming.html
I do use C++ Primer and it's really good
I don't know about it, but the Bjarne books are really lovely 😂.
😁👍i follow him in youtube but in the books i may follow for reference
Обсуждают сегодня