PO> I know how to make an object the normal way:
PO> player player1();
Well, no. That declares a function, returning a player, called player1, that
takes no arguements. :-)
player player1;
PO> but I am trying to create a certain user defined number of objects.
PO> Like:
PO> cout<<"Number of players ";
PO> cin>>n;
// in here:
player players = new player[n]; // n players.
PO> for(x=0; x {
PO> cout<<"Player Name ";
PO> cin.getline(name,20);
PO> /*now i want to create am object here with the name of 'name' but i
PO> don't know how*/
Actually, you'll need to use the array, and then have a function to set the
name.
players[x].setName(name);
PO> }
Hope this helps!
---
---------------
* Origin: Tanktalus' Tower BBS (1:250/102)
|