What is my mistake?

What am I doing wrong ?
thanks in advance.

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
  #include<iostream>
using namespace std;

class enemy{
	public:
		enemy(int x = 10):damage(x) {}
		void attack(){
			cout << "attack with " << damage<<endl;
		};
		int damage;
};

class boss: public enemy{
	public:
		boss(int x = 3):dub(x) {};
		void special(){
			cout <<"special attack with " << (damage * dub)<<endl;
		}
		int dub; 
		
};

main(){
	enemy en1();
	boss bo1();
	
	en1.attack();
	bo1.ataack();
	bo1.special();
}
What makes you think you're doing something wrong?
i cant compile it
These

1
2
	enemy en1();
	boss bo1();


are function declarations. Write instead

1
2
	enemy en1;
	boss bo1;
okay its working now thanks
Topic archived. No new replies allowed.