need help with pointer
How do i make a pointer within this code? Please help.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
#include <iostream>
using namespace std;
class BulletClass{
public:
BulletClass(string z){
setColour(z);
}
void setColour(string x){
Colour =x;
}
string getColour(){
return Colour;
}
private:
string Colour;
};
class PlayerClass{
public:
PlayerClass(int z){
setHealth(z);
}
int setHealth(int x){
Health = x;
}
int getHealth(){
return Health;
}
private:
int Health;
};
int main()
{
BulletClass bulletobject("Bullet black");
std::cout <<bulletobject.getColour()<< endl;
std::cout <<"Player ";
PlayerClass playerobject(100);
std::cout <<playerobject.getHealth()<<endl;
return 0;
}
|
You need to be more specific than "How do I hold shift and press 8?" - we have no idea how you want to use a pointer here.
Duplicate thread, see: http://www.cplusplus.com/forum/beginner/130806/
sorry my other post is a little bit more explained.
Topic archived. No new replies allowed.