#include #include using namespace std; int Name_Global {0}; class SillyT { public: SillyT() { ++Name_Global; name = Name_Global; cout << "Creating " << name << endl; } SillyT(const SillyT & src) { ++Name_Global; name = src.name * 100+Name_Global ; cout << "Creating " << name << endl; } //SillyT(const SillyT & src) = delete; //SillyT(const SillyT & src) = default; ~SillyT() { cout << "Destroying " << name << endl; } void BeSilly() { }; private: // ok, but there is a better way // SillyT(const SillyT & src) {}; int name; }; void Fun1() { cout << endl << endl << "Entering Fun 1 " << endl; SillyT c; cout << endl << endl << "Exiting Fun 1 " << endl; } void Fun2(SillyT param) { cout << "In Fun2" << endl; param.BeSilly(); cout << "Exiting Fun 2" << endl; return; } int main() { cout << "Starting Main" << endl; SillyT a; SillyT b(a); Fun2(a); cout << "Out of fun2" << endl << endl; //SillyT b; /* cout << endl; cout <<" Declaring the array" << endl; SillyT ary[3]; cout << "Declaring the pointer " << endl; SillyT * ptr{nullptr}; cout << "Grabbing some memory" << endl; ptr = new SillyT; cout << "Freeing the memory" << endl; delete ptr; cout << endl; cout << "Calling Fun1" << endl; Fun1(); cout << endl; */ cout << "Exiting Main " << endl; //return 0; }