#include #include #include using namespace std; class SimpleT { public: SimpleT(): x{static_cast(sqrt(static_cast(144)))} { cout << "\tIn the default constructor for SimpleT" << endl; } SimpleT(int value) { cout << "\tIn the paramter constructor for SimpleT" << endl; x = value; } SimpleT(const SimpleT & other) { cout << "\tIn the copy constructor for SimpleT" << endl; x = other.x; } ~SimpleT() { cout << "\tIn the destructor for SimpleT" << endl; } SimpleT & operator =(int other) { cout << "\tIn the overloaded = for SimpleT" << endl; x = other; return *this; } private: int x; }; class ComplexT { public: ComplexT(): b{4}, a{5}, c{3}, d{3.14} { cout << "In the default constructor for ComplexT" << endl; a = 7; return; } ComplexT(int data): //ComplexT(int data = 4): a{data}, b{a} // b{a}, a{data} { cout << "In the paramter constructor for ComplexT" << endl; } private: SimpleT a,b; int c; float d; }; int main() { cout << "Before ComplexT foo " << endl; ComplexT foo; cout << endl << endl; cout << "Before ComplexT bar(4) " << endl; ComplexT bar{4}; cout << endl << endl; cout << "Before ComplexT bar(4) " << endl; ComplexT foobar(4); cout << endl << endl; return 0; }