When we define some class in our C++ code, compiler is generating some important functions for our class (unless we define it explicitly). Those functions (sometimes called Compiled Generated Functions ) are: default constructor destructor copy constructor copy assignment operator During compilation, compiler knows our code and classes usage, so when we are using one of above functions implicitly, it generate that function implicitly for us in the class body. For better explenation, let's see the example below: In point (I) we are defining class TestClass . This class seems to be empty. However we are implicitly using following function in main class: point III - we are implicitly using defualt constructor in order to create instance of TestClass - default constructor of TestClass is implicitly generated by compiler point IV - we are using copy constructor of TestClass in order to copy instance to...
Comments
Post a Comment