Classes

This is a discussion on Classes within the C++ Programming forums, part of the General Programming Boards category; ok, here it goes. if i am using classes, say class game1, when I assign it to say "game1 level"may ...

  1. #1
    Boris-niet
    Guest

    Classes

    ok, here it goes. if i am using classes, say class game1, when I assign it to say "game1 level"may I call that anywhere in the program? also to call a function, do I just type say "level.character"?

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    If you make it global in the same module - Yes
    If you make it global in another module - Yes, if you use the extern keyword
    If you make it local - Yes, if you pass a pointer to it

    In your second question, you forgot the parantheses:

    level.character();
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

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, 11:47 AM
  2. Multiple Inheritance - Size of Classes?
    By Zeusbwr in forum C++ Programming
    Replies: 10
    Last Post: 11-26-2004, 09:04 AM
  3. im extreamly new help
    By rigo305 in forum C++ Programming
    Replies: 27
    Last Post: 04-24-2004, 12:22 AM
  4. Exporting VC++ classes for use with VB
    By Helix in forum Windows Programming
    Replies: 2
    Last Post: 12-29-2003, 05:38 PM
  5. include question
    By Wanted420 in forum C++ Programming
    Replies: 8
    Last Post: 10-17-2003, 04:49 AM

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