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 > C++ > copy constructo...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 4 Topic 43345 of 48417
Post > Topic >>

copy constructors; why can access private data?

by thomas <FreshThomas@[EMAIL PROTECTED] > Feb 15, 2008 at 04:58 PM

guys, I defined a copy constructor like this.

--code--
FiveTuple::FiveTuple(const FiveTuple &fv_tuple){
	source_ip_ = fv_tuple.source_ip_;
	dest_ip_ = fv_tuple.dest_ip_;
	source_****t_ = fv_tuple.source_****t_;
	dest_****t_ = fv_tuple.dest_****t_;
	ip_protocol_ = fv_tuple.ip_protocol_;
}
--code--

It works.

but the source_ip_, dest_ip_, etc are all private;
How can the copy constructor access private data of fv_tuple directly?
 




 4 Posts in Topic:
copy constructors; why can access private data?
thomas <FreshThomas@[E  2008-02-15 16:58:24 
Re: copy constructors; why can access private data?
"Alf P. Steinbach&qu  2008-02-16 02:05:52 
Re: copy constructors; why can access private data?
Jeff Schwab <jeff@[EMA  2008-02-15 17:31:47 
Re: copy constructors; why can access private data?
Martin York <Martin.Yo  2008-02-15 19:11:53 

Post A Reply:
  Go here to Signup

AddThis Feed Button


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

Contact
tan12V112 Fri Nov 21 10:42:32 CST 2008.