w klasie "Character" znajdują się obiekty klasy "Attack" ale z jakiegoś powodu gdy najeżdżam na nie to pokazuje się "this declaration has no storage class or type specifier" mam ten problem już od dwóch dni i nie mam pojecia co jest nie tak. Sprawdzałem jakies tutoriale, sprawdzałem dokumentacje, probowałem urzywac konstruktorów ale nic nie działa i zawsze jest ten sam problem. Może też mi ktoś wytłumaczyc co powoduje ten error? Na początku gdy zaczynałem z konstruktorem myślałem że jest to spowodowane tym że IDE uwarza knstruktor za nową funkcje ale teraz to nie mam po prostu pojęcia ...
#include <iostream>
#include <string>
struct Attack;
class Character;
class Enemy;
void BeginBattle();
void GameLoop();
void CloseGame();
int main() {
return 0;
}
struct Attack {
private:
int damage, accuracy, cooldown;
std::string name;
public:
void setAttackVariables(int, int, int, std::string);
};
void Attack::setAttackVariables(int dmg, int acc, int cd, std::string name) {
damage = dmg;
accuracy = acc;
cooldown = cd;
Attack::name = name;
}
class Character{
private:
int hp;
Attack att[3];
att[0].setAttackVariables(10,90,0,"Basic Swing");
att[1].setAttackVariables(175, 10, 1, "Blind Assult...!!");
att[2].setAttackVariables(45, 70, 3, "Smash Bros Smash!");
public:
};