help me in getting the concept of default constructor with example.
i don’t know when to use default constructor in the program and when not to.
help me coming over this problem.explain it with an example for me.
when it is necessary to use it?
#include<iostream>
using namespace std;
class abc
{
public:
abc()
{
cout<<"hello";
}
};
int main()
{
abc a;
system("pause");
return 0;
}
so actually what is the use of default constructor and when it is necessary to use it?
A class that conforms to the concept
DefaultConstrutibleallows the following expressions (paragraph 17.6.3.1 of N3242):So much for the concept. Paragraph 12.1/5 actually tells us what a default constructor is
With the introduction of deleted special member functions, the standard also defines a list of cases where no implicit default constructor is available and the distinction of trivial and non-trivial default constructors.