The idea is to store the player's name into a string. Here's the full source code...
ps. I'm working this out in the console command before throwing this onto win32 api, so please tell me if it'll be compatable when I switch it over. Thanks.
Code:#include <iostream> #include <string.h> class Common { public: std::string getName() const { return Name; } void setName(std::string a_name) { Name = a_name; } private: std::string Name; }; int main() { using std::cout; using std::cin; using std::endl; Common PC; PC.setName("Aylen"); cout << PC.getName() << endl; return 0; }
Bug:
Code:error C2679: binary '<<' : no operator defined which takes a right-hand operand of type 'class std::basic_string<char,struct std::char_traits<char>,class std::alloc



LinkBack URL
About LinkBacks


