Computer Science, asked by krishkarpe375, 6 months ago

give me one example of default constructor ​

Answers

Answered by Anonymous
3

Explanation:

When a class constructor does not explicitly call the constructor of one of its object-valued fields in its initializer list, the default constructor for the field's class is called. ... E.g. vector<MyClass>(10); initializes the vector with ten elements, which are filled with a default-constructed MyClass object.

hope it helps ☺️!!!

please mark the answer as brainliest

follow me.......

Answered by Anonymous
1

Answer:

The default constructor initializes instance variables with default values. For example, the int variable will be initialized to 0; Constructor types: No-Arg Constructor - a constructor that does not accept any arguments Parameterizedconstructor - a constructor that accepts arguments Default Constructor - a constructor that is automatically created by the Java compiler if it is not explicitly defined. A constructor cannot be abstract or static or final.

Similar questions