I have a member variable in the class CSpanaView,called ZoomIndicator. I want to access that variable in aother class CFastZoom. Below is the code by me to do above task
but there is a memory exception when i run the code above
You need to assign a valid address to *ptSpana before you can dereference it. Since you didn't assign any value to *ptSpana in its declaration, it is pointing to an invalid address. As a result, when you dereference it, memory exception occurs.
will always be invalid because you never actually create an object or otherwise assign the pointer. without more info on your code though i wont provide any more insight on how you should solve this except to say that you shouldn't access even public members VARIABLES in my opinion (i consider public variables bad design, there should be a member function that returns/sets the variable or something) but that's just my opinion and there are exceptions
i see kheun has just posted the same point while i was typing it up. my apologies.
Last edited by filthy_mcnasty; February 27th, 2004 at 02:47 AM.