Board index » delphi » Problems accessing member variables via pointer ..
JRed
![]() Delphi Developer |
Fri, 24 Oct 2003 20:20:59 GMT
Problems accessing member variables via pointer ..
Hi ... I have the following source code .... which I am having problems
with. Basically, I am trying to point to an object using pointers and access its member variables via the pointer ... no luck ... I hope you can help shed light on this problem ... Cheers, ----------------------- class TItem { Quote} ; public : TItem cereal ; void Purchase ( TItem *item) ; Quote} ; item = &cereal ; Quote} ; TItem *item_ptr = new TItem ; Cart.cereal.amount = 24.0 ; // initialise amount Cart.Purchase(item_ptr) ; // printf ("\n item_ptr->amount = %2.1f", item_ptr->amount); Quote} // Thank you .. |