What will be printed out as a result of the following code execution?

#include <iostream>
class A {
    explicit A(int _k = 10) {k = _k;}
    int k;
int main() {
    A a = int(100);
    std::cout << a.k;  
Compilation error will occur because of the following. Since default constructor is declared with an explicit modifier, it will not serve as a type conversion constructor.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
C++ quizzes
Sign Up Now
or Subscribe for future quizzes