Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

briktal

Classes

This topic is 6010 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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--

Share this post


Link to post
Share on other sites
Advertisement
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--

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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--

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
u should be clear next time

-anynomous poster-

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!