-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: rags_rao
Message 3 in Discussion
there is nothing called a "copy constructor" in c# (atleast i havent heard of one) u
can have a contructor with the same type as argument but it wont behave like a copy
constructor
class C
{
public int x,y;
public C(int x,int y)
{
this.x=x;
this.y=y;
}
public C(C c)
{
this.x = c.x;
this.y = 0;//dont copy y;
}
public static void Main()
{
C a = new C(10,20);
C b = a;//oops! copy contrcutor doesnt work here :(
C c = new C(a);//this works......
System.Console.WriteLine("a" + a.x + " " + a.y);
System.Console.WriteLine("b" + b.x + " " + b.y);
System.Console.WriteLine("c" + c.x + " " + c.y);
System.Console.WriteLine(a==b);//same object
}
}
--
"When the true king's murderers are allowed to roam free, a thousand magicians arise
in the land"
- Jim morrison
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you received
this message by mistake, please click the "Remove" link below. On the pre-addressed
e-mail message that opens, simply click "Send". Your e-mail address will be deleted
from this group's mailing list.
mailto:[EMAIL PROTECTED]