السلآم عليكم ورحمه الله
ممكن لاهنتوآ تشرحون لي هالكود
#include <iostream>
using namespace std;
class OBJ{
int* i;
public:
OBJ (){
i = 0 ;
cout<<"Default Constructor is called\n";}
OBJ (int x , OBJ obj)
{ i = new int; *i = x;
cout<<"Parametrized Constructor is called\n";
}
OBJ (const OBJ &obj)
{ i = new int;i = obj.i;
cout<<"Copy Constructor is called\n";
}
~OBJ(){
cout<<"\nFreeing i\n";
delete i;}
int get_I()
{return *i ;}};
int main ()
{ OBJ obj1;
OBJ obj3(10,obj1);
cout<<"Obj 2 i value: "<<obj3.get_I();
cout<<"maha\n";
return 0; }ومتى انادي الهادم للداله copy constructer