What will be printed out as a result of the following code's execution?
#include <iostream>
class A
{
public:
    A(void){this->_num=0;}
    int A(int num){this->_num=num;}
    ~A(void){std::cout << this->_num;}
private:
    int _num; 
};
int main(void)
{
    A val(100);
    return 0;
}
Explanation
Constructor cannot have a type of the return value (returning value by return operator is impossible)

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback