Why the default argument constructor is called the default constructor

Class A {
public:
       A(int i = 0, int k = 0) {} // default constructor WHY ??
       ~A() {}
};
int main()
{
  A a; // This creates object using defined default 
       // constructor but the constructor still has two arguments
  A b(1,2); // Called as parametrized one
}

Why is this default argument constructor the default constructor. Why is it not called a parameterized constructor or a parameterized default constructor, because even if this constructor is called without arguments, it contains two arguments? Is there any specific reason or its only because the standard speaks about it.

+4
source share
4 answers

C ++ 11 ยง12.1 Constructors

The default constructor for class X is the constructor of class X, which can be called without an argument.

. , , .

+8

- , . , .

, "", , , ++. , , .

+5

, . - , ,

A a;

A a=A();

- . , = > , , 'A()' = > , .

+1

++ , . quesrion.

+1

Source: https://habr.com/ru/post/1536761/


All Articles