| View previous topic :: View next topic |
| Author |
Message |
Chase Payne Grandmaster Cheater
Reputation: 1
Joined: 20 Mar 2008 Posts: 533
|
Posted: Thu May 20, 2010 9:56 pm Post subject: Classes, pointers, arrays into strings |
|
|
What this is, is basically strings *without* using string library.
If you're like me on, maybe perhaps chapter 17 in c++ you should (easily) be able to understand this, or maybe you can try playing around with it yourself to learn how pointers, classes and arrays can work together.
The program is below here:
http://rapidshare.com/files/389798761/Chase_s_Game.exe
Source codes:
http://pastebin.com/zmvVz8y8
^^ The string base
http://pastebin.com/vCMj10yR
^^ main code
No, this isn't something amazing... but I'm sure someone will make use with it.
Edit:: I meant to post this on binaries, move it if you want.
|
|
| Back to top |
|
 |
Flyte Peanuts!!!!
Reputation: 6
Joined: 19 Apr 2006 Posts: 1887 Location: Canada
|
Posted: Thu May 20, 2010 10:03 pm Post subject: |
|
|
The code that handles the internal array should be separate from the code that handles the class as an abstraction of the array. i.e. - make a class called 'string'; have that class hold a single string and allow whatever code that makes use of the class to preform operations on said string (and does nothing else).
Your program would then use this class.
|
|
| Back to top |
|
 |
Chase Payne Grandmaster Cheater
Reputation: 1
Joined: 20 Mar 2008 Posts: 533
|
Posted: Thu May 20, 2010 10:12 pm Post subject: |
|
|
| Flyte wrote: | The code that handles the internal array should be separate from the code that handles the class as an abstraction of the array. i.e. - make a class called 'string'; have that class hold a single string and allow whatever code that makes use of the class to preform operations on said string (and does nothing else).
Your program would then use this class. |
I'm not sure what you are implying here, are you saying it's better off having 2 classes? It seems to be working fine with just one.
Would there be any benefit of separating the voids form the class?
|
|
| Back to top |
|
 |
|