On 16 Oct 97, Steven Lei wrote to Paul Wankadia --
PW> Ye gods, Steven ... the term is "prototyping" ...
SL> Sorry, Paul!!! I keep on getting the two words confused for some
SL> reason... I guess I should talk more in Teen instead...
{snrk}
SL> Oh well... in CS class, I'm learning classes... and it doesn't seem
SL> that tough yet... well, pointers tomorrow... so prepare to answer
SL> some questions because I don't quite understand pointers and how they
SL> differ from reference parameters... (the & sign) vs the * sign.
You have
class foo {
int dog;
int cat;
};
You then create an object of class 'foo' by saying
foo bar;
A pointer to an object of class 'foo' is
foo *drog;
You can put the address of 'bar' into 'drog' by doing
drog = &bar;
To assign a value to 'dog' via 'bar', you'd say
bar.dog = 1275;
To assign a value to 'cat' via 'drog', you'd say
drog->cat = 1275;
OR, alternatively,
(*drog).cat = 1275;
Any questions?
--- PPoint 2.00
---------------
* Origin: Junyer's Workshop (1:342/1022.2)
|