Classes
I have a class which uses, say, test.GetStr() to get the character Test1''s strength. How can I use a variable, like "attacker" instead of "test" to do that?
--www.edf-project.org--
wat he said
like type this:
test* attacker= new test;
done
Edited by - SonShadowCat on December 11, 2001 9:56:52 PM
like type this:
test* attacker= new test;
done
Edited by - SonShadowCat on December 11, 2001 9:56:52 PM
I tried that, but I get an error that the variable does not have a member function GetStr() defined, or something like that.
--www.edf-project.org--
--www.edf-project.org--
quote:Original post by briktal
I tried that, but I get an error that the variable does not have a member function GetStr() defined, or something like that.
--www.edf-project.org--
Try using this:
attacker->GetStr();
if you dynamicly create an instance of a class, you have to use the -> to call your member functions...
"And that''s the bottom line cause I said so!"
Cyberdrek
Headhunter Soft
A division of DLC Multimedia
Resist Windows XP''s Invasive Production Activation Technology!
"gitty up" -- Kramer
/(bb|[^b]{2})/ that is the Question -- ThinkGeek.com
I used that, it seems to help, but does not appear to work if "attacker" is a string. It says something to the effect of cannot use -> with non-pointer type string.
--www.edf-project.org--
--www.edf-project.org--
About what?
I get an error: " base operand of '->' has non-pointer type 'string' "
Is there another variable type I should use?
--www.edf-project.org--
_____EDIT_____
I need information from another class in that function. Is there a better way to do this?
Edited by - briktal on December 11, 2001 10:17:30 PM
I get an error: " base operand of '->' has non-pointer type 'string' "
Is there another variable type I should use?
--www.edf-project.org--
_____EDIT_____
I need information from another class in that function. Is there a better way to do this?
Edited by - briktal on December 11, 2001 10:17:30 PM
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement