c++: public private error -


so i've got problem. want variables diferant class main , i've lerned it's hide data wont easely changed , use getxxx function acces it. tried use private: , public: thing when error saying

error: expected unqualified-id befor 'private'

i got class nr1# called dialog , class variables called race (not in black , white)

anyway call function this:(class dialog)

    above #include stuff     dialog::dialog(int y)     {         race raceo;        switch(y)        {      case 1: cout << "choose class \n1     elf = " << raceo.getstats(1.1) << endl; break: } 

and race class

//were supposed put private: , public:

    include "race.h"     include <iostream>     include <string>      using namespace std;        race::race(){     }      int race::raceelf(){     return 0;     }          int attack = 5;         int defence = 3;         int stamina = 6;       int race::getstats(int x){      if(x == 11){       return attack;     }     return 0;     } 

in class declaration should like

class myclass{ public: myclass(); private: double x,y,z; } 

that how should use public , private, otherwise can't see wrong, plase provide header file or class declaration.


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -