Can somebody tell me what i did wrong? I am really confused. (I have over 450 lines of code in my main program and because of a similar problem to this example i cant continue.)
Why are "Attack" and "Health" globals? If you create more than one monster then they will be modifying the same memory causing a runtime error. Secondly you have to return an integer in the "main" statement. Thirdly, lol, what exactly are you trying to do, are you just testing? Fourth, a pointer is not necessary for a class that can be created without allocating memory yourself, via new. Fifth, you are forgetting to delete "YourFireType" and thus you cause a memory leak, which basically is a memory space that is allocated by a program and not being used but still unusable after the program is ended. Sixth your problem is a name clash by the global variables and the member variables of your class.
You still have a bunch of problems
You have global variables of Attack and Health plus members of Monster class with the same name which could cause confusion
This
Attack == Monster.SetAttack();
Should probably be
1 2
Attack = Monster.GetAttack();
This
Health = YourFireType->SetHealth;
Should probably be
Health = YourFireType->GetHealth();
and this
Health == Health - Attack;
Should be
Health = Health - Attack;
And you still havent deleted the Monster you created
Seems like you have no clue what you are doing, this is simple stuff. I can hardly believe you actually wrote 450 lines of code
thanks the Get instead os Set fixed most of my problems, i only have 1 left
C:\Documents and Settings\User\My Documents\Untitled100.cpp In function `void YourFireType()': 32 C:\Documents and Settings\User\My Documents\Untitled100.cpp expected primary-expression before '.' token )
Angeljruiz, if i replace -> with . , my other functions will create a memory leak when defining, i gave you a testing function with a simplified version of one of mine (out of 6)
If you wanna try to fix my memory leak problem, go ahead, ill give you my whole program (unfinished) and you fix it for me
Listen, young whippersnapper, I have no desire to fix your memory leak problem. I was merely noting that you saying "I can't do this, because I'll have a memory leak" is pretty poor reasoning when what was suggested would actually fix a memory leak.