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

C

charles

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
 
B

Buster

charles said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top