trying to make a text base pokemon game

im making this just to get the feel of using c++ in a game directed format and a demo is better than a resume.

//define all pokemon as objects
class pokemon
{
public:

{

}
}object Bulbasaur, Ivysaur, Venasaur, Charmander, Charmeleon, Charizard, Squirtle, Wartortle, Blastoise, Caterpie, Metapod, Butterfree, Weedle,
Kakuna, Beedrill, Pidgey, Pidgeotto, Pidgeot, Rattata, Raticate, Spearow, Fearow, Ekans, Arbok, Pikachu, Raichu, Sandshrew, Sandslash, NidoramF,
Nidorina, Nidoqueen, NidoranM, Nidorino, Nidoking, Clefairy, Clefable, Vulpix, Ninetails, Jigglypuff, Wigglytuff, Zubat, Golbat, Oddish, Gloom,
Vileplume;


i figured the class would be pokemon because it represents the objects that are pokemon. how do i use ojects outside of a class. do i just call them like they're variables?
... do i just call them like they're variables?

They are not like variables, they are variable. So yes.
http://cplusplus.com/doc/tutorial/classes/
so i could call it like this?

bulbasaur;

what data type would it be?
Its type would be 'pokemon'. When you create a class, you are creating a type. When you create those objects (i.e. instantiate the class) you are creating variables.
1
2
int i; // creates a variable named 'i' of type 'int'
pokemon bulbasaur; // creates a variable named 'bulbasaur' of type 'pokemon' 
what does the int i variable do

thank you for helping me out guys i appreciate it
...It was an example, to show you how instantiating a class is like a basic type.
ok i was just making sure it wasn't related.

so the members would be the functions like

int function()
{
int=int+5;
return 0;
}
Last edited on
Methods are basically the same as normal functions except they can access data inside the class freely via the this pointer.
A class's members are its variables and its methods (sometimes called member functions.)

1
2
3
4
5
6
class Example {
   int memberVariable;

 public:
   void method();
};
Last edited on
there can be an array of pokemon-


//headers
using namespace std;
int main()
{
int array [493]

}
Last edited on
Topic archived. No new replies allowed.