for sum reason i keep getting a bunch of errors, in format of inheritance which to me is correct. i followed straight from the book. Can someone please help me?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
// snake class inheriting from class texture and collisionDetection
class Snake : public class Texture, public class CollisionDetection
{
int snakePos;
public:
void drawSnake();
void setSnakePos();
void eatFruit();
};
// fruits class inheriting public members of class texture
class Fruits : public class Texture
{
public:
void drawFruit();
void setFruitColor();
void randFruitPos();
};
// map class inheriting protected and public members of class texture
class Map : protected Texture
{
public:
void drawSurface();
void drawBorders();
void drawCubes(double x, double y, double z);
void drawObstacles();
};
class Texture
{
GLuint snakeTexture[];
GLuint fruitTexture[];
GLuint gridTexture[];
protected:
GLuint loadTexture();
GLuint change3DEnvironment();
public:
friend GLuint setSnakeTexture();
friend GLuint setgridTexture();
friend GLuint setFruitTexture();
};
class CollisionDetection : public class Map, public class Fruits
{
void snakeNObstacle();
void snakeNCubes();
void snakeNFruits();
};
|
errors:
||=== Build: Debug in project c++ (compiler: GNU GCC Compiler) ===|
C:\Users\Juice\Documents\C++ Assignments\project c++\main.h|75|error: expected class-name before 'class'|
C:\Users\Juice\Documents\C++ Assignments\project c++\main.h|75|error: expected '{' before 'class'|
C:\Users\Juice\Documents\C++ Assignments\project c++\main.h|75|error: expected unqualified-id before ',' token|
C:\Users\Juice\Documents\C++ Assignments\project c++\main.h|75|error: expected unqualified-id before 'public'|
C:\Users\Juice\Documents\C++ Assignments\project c++\main.h|87|error: expected class-name before 'class'|
C:\Users\Juice\Documents\C++ Assignments\project c++\main.h|87|error: expected '{' before 'class'|
C:\Users\Juice\Documents\C++ Assignments\project c++\main.h|93|error: multiple types in one declaration|
C:\Users\Juice\Documents\C++ Assignments\project c++\main.h|105|error: redefinition of 'class Texture'|
C:\Users\Juice\Documents\C++ Assignments\project c++\main.h|87|error: previous definition of 'class Texture'|
C:\Users\Juice\Documents\C++ Assignments\project c++\main.h|122|error: expected class-name before 'class'|
C:\Users\Juice\Documents\C++ Assignments\project c++\main.h|122|error: expected '{' before 'class'|
C:\Users\Juice\Documents\C++ Assignments\project c++\main.h|122|error: expected unqualified-id before ',' token|
C:\Users\Juice\Documents\C++ Assignments\project c++\main.h|122|error: expected unqualified-id before 'public'|
C:\Users\Juice\Documents\C++ Assignments\project c++\main.cpp|7|error: aggregate 'Snake Snakes' has incomplete type and cannot be defined|
||=== Build failed: 14 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|