On Mon, Mar 2, 2009 at 11:35 AM, Michael Sullivan <[email protected]>wrote:
> I keep getting these access violations, and the line the program seems to
> stop on is
>
>
> string Character::getIMFileName() {
> return imageMapFileName; }
>
>
>
> Her'e the Character class:
>
>
>
> class
> Character
>
> {
>
> private
> :
>
> string name;
>
> int curHP;
>
> int curMP;
>
> int maxHP;
>
> int maxMP;
>
> int xPos;
>
> int yPos;
>
> string imageMapFileName;
>
> int curImage;
>
> public
> :
>
> Character(
> void);
>
> ~Character(
> void);
>
> string getName();
>
> void setName(string n);
>
> int getCurHP();
>
> void setCurHP(int hp);
>
> int getCurMP();
>
> void setCurMP(int mp);
>
> int getMaxHP();
>
> void setMaxHP(int hp);
>
> int getMaxMP();
>
> void setMaxMP(int m);
>
> string getIMFileName();
>
> void setIMFileName(string fn);
>
> int getX();
>
> void setX(int x);
>
> int getY();
>
> void setY(int y);
>
> int getCurImage();
>
> void setCurImage (int ci);
>
> };
>
>
>
> imageMapFileName is set with
>
> void
> Character::setIMFileName(string fn) { imageMapFileName = "./" + fn; }
>
>
>
> That method is being called, but for some reason, imageMapFileName is not
> being set. When I set a breakpoint on the setIMFileName line and run it,
> down in the Watch window it says " imageMapFileName CXX0069: Error:
> variable needs stack frame". What is this stack frame? When the
> getIMFileName method gets called and the program fails, this is in the watch
> window:
>
>
>
> - imageMapFileName {_Bx={...} _Mysize=??? _Myres=???
> } std::basic_string<char,std::char_traits<char>,std::allocator<char> >
> + [actual members] {_Bx={...} _Mysize=??? _Myres=???
> } std::basic_string<char,std::char_traits<char>,std::allocator<char> >
>
>
I think I've got it, but I need to ask a question first: Ally inherits from
Character. In Java, this would mean that Ally would have all the public
methods that Character has. In C++ I cant take an Ally ally and say
ally.getIMFileName(), can I? If that's true, then I think I know what's
wrong...
[Non-text portions of this message have been removed]