> > > Can someone point me in the direction (if you'll excuse the pun) of a
> > > good explanation of the difference between '->' and '.'.
> > > As far as I understand '->' is used when accessing data or methods in a
> > > class when the class is defined on the heap. '.' is used when accessing
> > > data or member methods on the stack.Does this apply to struct as well as
> > > classes. How do you know you are using the stack or heap anyway. This
> > > and any other information that would help understand the difference
> > > would be helpful
> > Nope. Not at all. -> is used when you access class/struct via a
> > pointer, while . is used when it isn't one:
> "Not at all"?? How is storage for pointers usually allocated?
Don't make me mad! They have _nothing_ to do with each other! In C
interfaces the structures are (and can only be) passed as pointers! Are
they allocated on the stack? Depending on your program it may well be
true that most of them are _not_. There are _several_ (like
gethostbyname) functions returning pointer to a static structure... Are
those allocated on the stack? NO!
Quote:> How is storage for non-pointer variables usually allocated?
ANY way I want:
long void drinkVodka( const VodkaDesc &vd, long long dl) {
//... glup
Quote:}
// VodkaDesc is abstract
int main(void) {
VodkaDesc *avd;
avd = abstractVodkaFactory( cin, dontPayTaxes /*enum*/);
drinkVodka( *avd, 150);
delete avd;
abort();
Quote:}
> I think the OP was on the right track - just needed some clarification.
And I think not. The _way_ teh structures/classes are _allocated_ has
_nothing_ to do with the way we access them.
Attila