Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Java Programmer > Re: is an objec...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 6 of 6 Topic 52628 of 55513
Post > Topic >>

Re: is an object deep-copied when added to a collection?

by Andrea Francia <andrea.francia@[EMAIL PROTECTED] > May 11, 2008 at 01:22 AM

Mark Space wrote:
> Vector<Date*> alist = Vector<Date*>();
> 
> Date *d = new Date();
> 
> alist.add(d);
> 
> Or something like that, it's been a long time since C++.....

Your example is almost correct.
The only things that need to be corrected are the initialisation
and the name of the method which add an entry to the vector.

vector<Date *> alist; // default constructor called implicitly

Date *d = new Date;

alist.push_back(d);

Also I don't use c++ since long time ago, maybe I mistaked something else.

-- 
Andrea Francia
alias rm='trash' #use trash command instead of removing
rm -Rfv file     #put the file in the KDE trashcan
http://www.andreafrancia.it/trash
 




 6 Posts in Topic:
is an object deep-copied when added to a collection?
lucia.roibal@[EMAIL PROTE  2008-05-10 11:07:15 
Re: is an object deep-copied when added to a collection?
Eric Sosman <esosman@[  2008-05-10 14:18:20 
Re: is an object deep-copied when added to a collection?
"Peter Duniho"   2008-05-10 11:40:12 
Re: is an object deep-copied when added to a collection?
ptomblin+netnews@[EMAIL P  2008-05-11 02:27:51 
Re: is an object deep-copied when added to a collection?
Mark Space <markspace@  2008-05-10 11:39:57 
Re: is an object deep-copied when added to a collection?
Andrea Francia <andrea  2008-05-11 01:22:25 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Dec 3 19:04:23 CST 2008.