Class Limits

Discussion in 'C++' started by junkmonkey, Mar 8, 2006.

  1. junkmonkey

    junkmonkey Guest

    Hey everyone. This is much more of a general question than a
    code-specific one. For class, I need to write a text-based adventure
    game. I know that I will be using classes to implement different
    aspects of the game (player, rooms, traps, etc.) and was wondering what
    are the limitations on classes. As of now, I know they basically
    define a user-defined type, and have elements of that type. These
    members can also be used in class specific functions called methods. I
    guess what I'm getting at is how do I know what to make a class, and
    what to make a simple variable. Secondly, how do I use pointers to
    navigate from room to room?
    Sorry about the broadness of this question, but I've been perusing
    my notes and my understanding of classes is within my grasp, but
    something fundamental is ultimately missing. Thanks again!

    ~junk
     
    junkmonkey, Mar 8, 2006
    #1
    1. Advertising

  2. junkmonkey

    mlimber Guest

    junkmonkey wrote:
    > Hey everyone. This is much more of a general question than a
    > code-specific one. For class, I need to write a text-based adventure
    > game. I know that I will be using classes to implement different
    > aspects of the game (player, rooms, traps, etc.) and was wondering what
    > are the limitations on classes. As of now, I know they basically
    > define a user-defined type, and have elements of that type.


    I'm not sure what "have elements of that type" means. Classes can have
    members of any type.

    > These
    > members can also be used in class specific functions called methods. I
    > guess what I'm getting at is how do I know what to make a class, and
    > what to make a simple variable.


    Generally speaking, classes are intended to encapsulate data behind an
    interface so that the programmer can concentrate on behavior rather
    than implementation details. (Then again, there are also policy classes
    and other classes that don't fit this definition.) See these FAQs:

    http://www.parashift.com/c -faq-lite/classes-and-objects.html

    > Secondly, how do I use pointers to
    > navigate from room to room?


    This question is unanswerable without more details since it depends
    what your pointers point to.

    > Sorry about the broadness of this question, but I've been perusing
    > my notes and my understanding of classes is within my grasp, but
    > something fundamental is ultimately missing. Thanks again!


    Do you have a good book such as _Accelerated C++_ by Koenig and Moo?

    Cheers! --M
     
    mlimber, Mar 8, 2006
    #2
    1. Advertising

  3. mlimber wrote:
    > [..] Classes can have
    > members of any type.


    <nitpick>
    Classes cannot have elements of their own types, or any incomplete
    types for that matter.
    </nitpick>

    V
    --
    Please remove capital As from my address when replying by mail
     
    Victor Bazarov, Mar 8, 2006
    #3
  4. junkmonkey

    Neil Cerutti Guest

    On 2006-03-08, junkmonkey <> wrote:
    > Hey everyone. This is much more of a general question than a
    > code-specific one. For class, I need to write a text-based
    > adventure game.


    Unless you must use C++ as a condition of your project, I recommend
    considering a couple of the domain-specific programming languages for
    writing text-based adventure games, specifically, TADS and Inform. You
    wouldn't have the fun/pain of developing your own world model or
    natural-language parser, but you'd increase the robustness,
    portability and development speed of your game considerably.

    > Sorry about the broadness of this question, but I've been perusing
    > my notes and my understanding of classes is within my grasp, but
    > something fundamental is ultimately missing. Thanks again!


    Head on over to rec.arts.int-fiction for help. Most text adventures
    are written in domain-specific languages nowadays, but there are a few
    mavericks around, and lots of experienced "interactive fiction"
    developers for you to learn from.

    --
    Neil Cerutti
    You only get a once-in-a-lifetime opportunity so many times.
    --Ike Taylor
     
    Neil Cerutti, Mar 9, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. jack
    Replies:
    0
    Views:
    6,117
  2. Ashish
    Replies:
    1
    Views:
    3,155
    Natty Gur
    Nov 19, 2003
  3. Jerry Camel

    File Upload Limits

    Jerry Camel, Feb 20, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    381
    Ken Cox [Microsoft MVP]
    Feb 21, 2004
  4. E11
    Replies:
    1
    Views:
    4,842
    Thomas Weidenfeller
    Oct 12, 2005
  5. Walt Karas
    Replies:
    5
    Views:
    329
    Walt Karas
    Sep 5, 2004
Loading...

Share This Page