cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
C++ HELP Class Error!!!
C++ HELP Class Error!!!
Dec 28, 2013 at 5:13pm UTC
TrentIsDino
(11)
//Look below and there is an error please help
#include <iostream>
#include <string>
#include <vector>
#include <ctime>
#include <cstdlib>
using namespace std;
class Walk
{
public:
string m_Terrain;
int m_Select;
void Left(int);
Walk();
};
Walk::Walk()
{
}
void Walk::Left(int select)
{
m_Select = select;
if (m_Select <= 3)
{
m_Terrain = "----------me----goblin--------------------------------------\n\n";
cout << m_Terrain;
}
else
{
m_Terrain = "----------me------------------------------------------------\n\n";
cout << m_Terrain;
}
}
int main()
{
srand(static_cast<unsigned int>(time(0)));
int a = rand();
int b = (a % 6) + 1;
Walk walkL();
//It says Walk walkL()
//Error: expression must have a class type??????????????Waht does that mean???
walkL.Left(b);
return 0;
}
Dec 29, 2013 at 4:26am UTC
Yanson
(885)
Please use code tags
http://www.cplusplus.com/articles/z13hAqkS/
Walk walkL();
should be
Walk walkL;
Dec 30, 2013 at 5:56pm UTC
TrentIsDino
(11)
sorry i didn't know about the tags. I'm new. But anyway thanks for the fix.
Topic archived. No new replies allowed.