Heh my first C++ object

Posted by shadowstrike32 on July 15, 2006, 2 a.m.

Kind of a milestone, assuming that 12 hours ago OOP had me shitting myself.

Gamemakers implementation of an object model makes this stuff look easy!

struct human {
       char name[50];
       int height;
       float weight;
       
       void printStats(void);
       void excersize(int hours);
       void init (char name_ts[49], int height_ts, float weight_ts);
};

void human::printStats(void) {
     printf ("Name: %s, Height: %d, Weight: %d", name, height, weight);
}
void human::excersize(int hours) {
     weight -= (float)hours*.515;
     printf ("%s excersized! horray", name);
}
void human::init(char name_ts[49], int height_ts, float weight_ts) {
     strcpy( name, name_ts);
     height = height_ts;
     weight = weight_ts;
}

Yep, the human class. never knew we were so basic.

Yeah, im not going to put this on the front page. I ll leave this here for you loyal ss32 fans to view.

Comments

DFortun81 18 years, 4 months ago

Seeing stuff like that make me feel good there is GM. ;)

Amarin 18 years, 3 months ago

@DF81: Ditto. Are there any Irrlicht users here?