Game Programming and Development Tools

Either im broken, or my computer is... AGAIN... – Realm Master

Realm Master

Member

Posts: 1971
From: USA
Registered: 05-15-2005
GAAA!! WHats wrong with my code! im trying a basic inheritence in C++ and my computer keeps giving me an error message saying "class 'Advanced' has no field 'name'" and so on! But ADVANCED IS SUPPOSED TO HAVE INHERITED THOSE FIELDS FROM GENERAL!!! WHATS GOING ON!???!?!

*sigh* here's the code guys...


#include <iostream>
#include <string>

using namespace std;

class General
{
public:

General(string& names = "Jhonny", int hits = 10, string& lines = "Sup dude..", int trust = 2): name(names), health(hits), line(lines), faith(trust)
{}

protected:
string name;
int health;
string line;
int faith;


};

class Advanced: public General
{
public:

Advanced(string& names = "Huge", int hits = 10, string& lines = "Hey man! Long time no see!", int trust = 10, int books = 10):
name(names),
health(hits),
line(lines),
faith(trust),
knowledge(books)
{}

protected:

int knowledge;

};


as you see, i was TRYING to work on a basic text adventure as an early early early early early early early early early early early(to the 10000 billionth power) form of "The Good Sheperd" (see my post "Game Idea! (oh plz God ...")

Somebody, anybody, HELP!!!

------------------
(yes, i know im stupid)
God rules!

Blessed are those who show mercy.
They will be shown mercy. - Matthew 5:7

Blessed are those who suffer for doing what is right.
The kingdom of hevan bleongs to them.-Matthew 5:10

Realm Master

Member

Posts: 1971
From: USA
Registered: 05-15-2005
nvm. i figured it out....

------------------
(yes, i know im stupid)
God rules!

Blessed are those who show mercy.
They will be shown mercy. - Matthew 5:7

Blessed are those who suffer for doing what is right.
The kingdom of hevan bleongs to them.-Matthew 5:10