New to C++ Classes

This is a discussion on New to C++ Classes within the C++ Programming forums, part of the General Programming Boards category; Um, I really don't know what you're talking about. I remember when I was trying to learn Java there was ...

  1. #121
    Registered User
    Join Date
    Jun 2007
    Posts
    66
    Um, I really don't know what you're talking about. I remember when I was trying to learn Java there was a command thing "this"
    Is that what you're talking about?

  2. #122
    Registered User
    Join Date
    Jan 2005
    Posts
    7,317
    Yes. When you are inside a member function of a class, and you want to refer to the object that is currently being used, you use "this" which is a special keyword just for that purpose. It is a pointer to the current object, which in this case is a GameManager. Since your functions want a reference to a GameManager, not a pointer, you use the * which is why you want to pass *this.

    This might be a little advanced for you. Unfortunately, its probably the best way to get your program working without changing the design. Ideally, your MainManager function would not be part of the GameManager class, but I wouldn't worry about changing that until after you get this part working.

  3. #123
    Registered User
    Join Date
    Jun 2007
    Posts
    66
    OK, the program seems to be working just fine now. Thank you so so so so so much for your help. I understand how frustrating it can be helping a noobie out and I really really appreciate your help. I'm going to try my best to learn more about C++ classes. I have learned a lot from you. Thank you to all the other people that have helped me along the path of C++ too. My program wouldn't be running without any of your help.

    Here is the program, props to all of you.
    http://z33.zupload.com/download.php?...filepath=39587

    Edit: are there any tutorial on doing cool things like how to center text and make a cool welcome screen? Just little fun things that I can try out.
    I'm also going to be doing little things to it, like I added an "Exit" command to exit the battle arena and the shop.
    Last edited by Cypher; 07-05-2007 at 03:51 PM.

Page 9 of 9 FirstFirst 123456789
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Can you Initialize all classes once with New?
    By peacerosetx in forum C++ Programming
    Replies: 12
    Last Post: 07-02-2008, 10:47 AM
  2. im extreamly new help
    By rigo305 in forum C++ Programming
    Replies: 27
    Last Post: 04-23-2004, 11:22 PM
  3. Exporting VC++ classes for use with VB
    By Helix in forum Windows Programming
    Replies: 2
    Last Post: 12-29-2003, 04:38 PM
  4. Prime Number Generator... Help !?!!
    By Halo in forum C++ Programming
    Replies: 9
    Last Post: 10-20-2003, 07:26 PM
  5. include question
    By Wanted420 in forum C++ Programming
    Replies: 8
    Last Post: 10-17-2003, 03:49 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21