Gopi Krishna Komanduri wrote:
> Hi,
>     to say very simply like .. if there is any class like student which had 
> single parameterised constructor like student(int i).  Then ,we mention 
> anything like Student x=10; 
>   Consider the following example:
>   class student
>   {
>   int num;
>   public:
>   student()
>   {// some implementation
>   }
>   student(int i)
>   {
>   num=i;
>   //some implementation
>   }
>   student operator = (student &obj)
>   {
>   }
>   };
>   main()
>   {
>   student x;
>   student st1=10; // here a tem object will be created with 10 as parameter 
> and calls parameterised constructor. Then default copy constructor will be 
> called to copy the temp object to our desired object.(I tried by giving a 
> deep copy constructor , i eman I provided a copy constructor . But hetting an 
> error because , it is trying to type caset 10 into the class reference.) Then 
> that temp object will be deleted. 
>   
Nope,   sutdent st1 = 10;  will call the constructor that can take an arg 10

Reply via email to