41.
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<<"A's Constructor called\n";
	}
	~A(){
		cout<<"A's Destructor called\n";
	}
};
class B{
	A a;
public:
	B(){
		cout<<"B's Constructor called\n";
	}
	~B(){
		cout<<"B's Destructor called\n";
	}
};
int main(int argc, char const *argv[])
{
	B b1;
}

42.
How constructors are different from other member functions of the class?

43.
How destructor overloading is done?

44.
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);
}

46.
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<<"A's Constructor called\n";
	}
	~A(){
		cout<<"A's Destructor called\n";
	}
};
class B: public A{
public:
	B(){
		cout<<"B's Constructor called\n";
	}
	~B(){
		cout<<"B's Destructor called\n";
	}
};
int main(int argc, char const *argv[])
{
	B b1;
}

47.
What is the difference between constructors and destructors?

48.
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<<"A's Constructor called\n";
	}
	~A(){
		cout<<"A's Destructor called\n";
	}
};
class B{
	static A a;
public:
	B(){
		cout<<"B's Constructor called\n";
	}
	~B(){
		cout<<"B's Destructor called\n";
	}
};
int main(int argc, char const *argv[])
{
	B b1;
}

49.
What will be the output of the following C++ code?
#include <iostream>
#include <string>
using namespace std;
class A{
	int a;
public:
	A(int i){
		a = i;
	}
	void assign(int i){
		a = i;
	}
	int return_value(){
		return a;
	}
};
int main(int argc, char const *argv[])
{
	A obj;
	obj.assign(5);
	cout<<obj.return_value();
}