473,396 Members | 1,743 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Class Limits

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

Mar 8 '06 #1
3 1666
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-lit...d-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

Mar 8 '06 #2
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
Mar 9 '06 #3
On 2006-03-08, junkmonkey <fu********@gmail.com> 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
Mar 9 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Andrew James | last post by:
All, I'm having some trouble with understanding python's importing behaviour in my application. I'm using psyco to optimise part of my code, but I'm not sure whether it inherits throughout the...
14
by: Grant Edwards | last post by:
I want to subclass an IMAP connection so that most of the methods raise an exception if the returned status isn't 'OK'. This works, but there's got to be a way to do it that doesn't involve so...
25
by: Maurice LING | last post by:
Hi, I think I've hit a system limit in python when I try to construct a list of 200,000 elements. My error is malloc: vm_allocate (size = 2400256) failed...... Just wondering is this...
5
by: Walt Karas | last post by:
Is this code legal under the standard? struct A { int i; struct C { unsigned offset_of_c(void) { return((unsigned) &(((A *) 0)->c)); }
4
by: platho | last post by:
Hello, I bounced into the max 25 columns index limits on DB2 v7.2 on NT. Is this still so in other operating systems or in v8 ? Are there plans to change this in the future ? Any workarounds...
16
by: Mark Bruno | last post by:
Hey, I'm learning about the limits header, and I don't understand one snippit of code. If I code: #include <limits.h> #include <stdio.h> int main() { printf("Smallest signed long long:...
37
by: Carol Depore | last post by:
How do I determine the maximum array size? For example, int a works, but a does not (run time error). Thank you.
9
by: Brian Henry | last post by:
If i inherite a queue class into my class, and do an override of the enqueue member, how would i then go about actually doing an enqueue of an item? I am a little confused on this one... does over...
88
by: santosh | last post by:
Hello all, In K&R2 one exercise asks the reader to compute and print the limits for the basic integer types. This is trivial for unsigned types. But is it possible for signed types without...
44
by: vippstar | last post by:
n1256.pdf (C99 TC3), 5.2.4.1 Translation limits p1 says: Does that mean that *any* program using an array of two or more elements other than char is allowed to be rejected by an implementation?...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.