C++ Programming Question: Download C++ Programming PDF
What is a default constructor in C++?
Answer:
Default constructor WITH arguments
class B {
public:
B (int m = 0) : n (m) {}
int n;
};
int main(int argc, char *argv[])
{
B b;
return 0;
}
class B {
public:
B (int m = 0) : n (m) {}
int n;
};
int main(int argc, char *argv[])
{
B b;
return 0;
}
Previous Question | Next Question |
How does throwing and catching exceptions differ from using setjmp and longjmp? | What is a conversion constructor C++? |