?
What will be the output of the following C++ code?
What will be the output of the following C++ code?
#include <iostream>
#include <string>
using namespace std;
class A{
mutable int a;
public:
A(){
cout<<"Default constructor called\n";
}
A(const A& a){
cout<<"Copy Constructor called\n";
}
};
int main(int argc, char const *argv[])
{
A obj;
A a1 = obj;
A a2(obj);
}
#include <iostream>
#include <string>
using namespace std;
class A{
mutable int a;
public:
A(){
cout<<"Default constructor called\n";
}
A(const A& a){
cout<<"Copy Constructor called\n";
}
};
int main(int argc, char const *argv[])
{
A obj;
A a1 = obj;
A a2(obj);
}
Join the Discussion
Login to post a comment or share your explanation.
Login