By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,134 Members | 1,796 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,134 IT Pros & Developers. It's quick & easy.

i can't understand this statement: &origin + ( &Point3d::_y - 1 );

P: n/a
when i read the notable book of inside the c++ bject model ,i was
confused by the chapter 3.3. i was confused by the statement as follow:
chaper 3.3:

Given the following pair of program statements:

Point3d origin; .....Access of a nonstatic data member requires the addition
of the beginningaddress of the class object with the offset location of the
data member.For example, givenorigin._y = 0.0; the address of&origin._y; is
equivalent to the addition of&origin + ( &Point3d::_y - 1 ); i don't
understand why the address of object of origin is compute by the
this : &origin + (&Point3d::_y -1 ) ;
especially for &Point3d::_y ,it is what ?
thanks for any clue?

regards
coco
Jul 22 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
charles wrote:
when i read the notable book of inside the c++ bject model ,i was
confused by the chapter 3.3. i was confused by the statement as follow:
chaper 3.3:

Given the following pair of program statements:

Point3d origin; .....Access of a nonstatic data member requires the addition
of the beginningaddress of the class object with the offset location of the
data member.For example, givenorigin._y = 0.0; the address of&origin._y; is
equivalent to the addition of&origin + ( &Point3d::_y - 1 ); i don't
understand why the address of object of origin is compute by the
this : &origin + (&Point3d::_y -1 ) ;
especially for &Point3d::_y ,it is what ?


( &Point3d::_y - 1 ) is the offset location of the data member, like
Stan says. The significance of the " - 1" is explained elsewhere.

This isn't C++ syntax, it's "pseudocode" for humans. Everything in
pseudocode is also explained in the text. You'll get used to it.

--
Regards,
Buster.
Jul 22 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.