c++ - Not detecting members in a class -


here exact error given code::blocks

d:\cpp\adventuretimetest\main.cpp|12|error: 'class adventure' has no member named 'drawmap'

here code:-

in main.cpp

#include <iostream> #include "adventure.h"  using namespace std;  int main() {     adventure a;      a.setmapsize(10);     a.drawmap();      return 0; } 

in adventure.h

class adventure {     public:         adventure();         virtual ~adventure();          int mapsize;         void setmapsize(int mapsize);         int getmapsize();          void drawmap();      protected:     private: }; 

and, finally, in adventure.cpp

#include <iostream> #include "adventure.h"  using namespace std;  adventure::adventure() { }  adventure::~adventure() { }  void adventure::setmapsize(int par1) {     mapsize = par1; }  int adventure::getmapsize() {     return mapsize; }  void adventure::drawmap() {     for(int x = 0; x <= mapsize; x++)     {         for(int y = 0; y <= mapsize; y++)         {             cout << ". ";         }         cout << endl;     } } 

thanks, can issue resolved quickly.


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -