Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » Who is doing the coping? [implicit-copy | deep-copy | pick constructor]
Re: Who is doing the coping? [implicit-copy | deep-copy | pick constructor] [message #38424 is a reply to message #38422] Sat, 15 December 2012 09:35 Go to previous messageGo to previous message
dolik.rce is currently offline  dolik.rce
Messages: 1791
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

Hi navi,
navi wrote on Sat, 15 December 2012 05:24

I concluded that C++ is writing a implicit copy constructor which is doing a member-wise copy of 'myobject' and neither U++ deep copy nor pick is being used. since myobject only has 3 String and String class has operator= overloaded, so implicit copy constructor is able to carryout its member-wise copy. Is this correct?

Yes this is correct. The implicit copy instructor in you case would look like
myobject::myobject(const myobject& that)
	this.a = that.a;
	this.b = that.b;
	this.c = that.c;
};

So it works for Strings, but if you did similar thing with Vector, it would use pick assignment operator.

Honza
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Is this a intended behavior for Upp widgets?
Next Topic: circular 'uses' chain
Goto Forum:
  


Current Time: Sun Aug 24 11:34:08 CEST 2025

Total time taken to generate the page: 0.03947 seconds