#include<iostream>
using namespace std;
class weapon {
private:
int damage;
string name;
public:
weapon(const string& n, int d) {
name = n;
damage = d;
}
};
class sword : public weapon {
private:
int sharpness;
public:
sword(const string& n, int d, int s) : weapon(n,d), sharpness(s) {}
};
class gun : public weapon {
private:
int capacity;
public:
gun(const string& n, int d, int c) {
weapon(n,d);
capacity = c;
}
};
int main() {
sword s("Katana", 72, 41);
gun g("AK-47", 74, 30);
return 0;
}
in sword class, sword function is working fine with this syntax but in gun class gun function is giving me this error : no matching function for call to weapon:weapon()