declaration error

What have I done wrong?

(wizard.cpp)
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
#include <iostream>

#include "wizard.h"
#include "main.h"

using namespace std;

void player::play_card()
{
	cout<<wiz<<"Deine Handkarten:"<<endl;
	for(int i=0;i<20&&cards[i]!=NULL;i++)
	{
		cout<<i+1<<": ";
		
		if(cards[i].get_colour()==nation.Menschen) cout<<"Menschen ";
		else if(cards[i].get_colour()==nation.Elfen) cout<<"Elfen ";
		else if(cards[i].get_colour()==nation.Zwerge) cout<<"Zwergen ";
		else if(cards[i].get_colour()==nation.Riesen) cout<<"Riesen ";
		
		switch(cards[i].get_value())
		{
			case 0:
				cout<<"Narr";
			case 14:
				cout<<"Zauberer";
			default:
				cout<<cards[i].get_value();
		}
		
		if((i+1)%2==0) cout<<endl;
		else cout<<"\t";
	}
	
	cout<<"Welche Karte willst du spielen?";
	
	int n;
	cin>>n;
	
	
}


(wizard.h)
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#ifndef __WIZARD_H__
#define __WIZARD_H__

typedef enum{
	Menschen,
	Elfen,
	Zwerge,
	Riesen	
} nation;

class card
{
	int value;	//1 - 13: normal, 0: Narr, 14: Zauberer
	nation colour;
	
public:
	card(int val, nation n)
	{
		value=val;
		colour=n;
	};
	
	int get_value() {return value;};
	nation get_colour() {return colour;};
};

class base_table
{
public:
	virtual void play_card(card *c);
};

class player
{
	std::string name;
	card *cards[20];	//Handkarten (20 wegen höchstmöglicher Anzahl)
	base_table *t;
	int tricks;		//gemachte Stiche
	int guessed;		//vorhergesagte Stiche
	int points;
	
	
public:
	virtual void play_card();
	virtual bool is_ai() {return false;};
	virtual void guess();
	void receive_card(card *c);
	void set_table(base_table *tbl) {t=tbl;};
};

class ai_player:public player
{
public:
	virtual bool is_ai() {return true;};
};

class pile
{
	card *cards[60];	//Alle Karten des Spiels
	int nocards;		//Anzahl der Karten im Stapel
	bool unused[60];

public:
	void shuffle();
	void reinit();
	void give_card(player* p, int no);
};

class table:public base_table
{
	card *cards[6];		//Es können maximal 6 Karten offen liegen
	card *trump;		//Trumpfkarte bzw. -farbe
};

class game
{
	pile p;
	table t;
	player players[6];	//Alle mitspielenden Spieler
	int numplayers;
	
public:
	void run(void);
};

#endif 


The errors:

15	wizard.cpp	'get_colour' has not been declared
15	wizard.cpp	request for member of non-aggregate type before '(' token
15	wizard.cpp	expected primary-expression before '.' token


The same thing for get_value.

Don't mind the comments, it's german and only for the documentation.
You use incorrect syntax. You declared an array of pointers

card *cards[20];

but then you are writing

if(cards[i].get_colour()==nation.Menschen) cout<<"Menschen ";

if cards[i] is a pointer then you shall write

if(cards[i]->get_colour()==nation.Menschen) cout<<"Menschen ";


or change your declaration of the array.
oh, thank you a lot ^^
Topic archived. No new replies allowed.