I'm working on a project for uni and I was thinking about a simple game where you construct ships and battle with a fleet of 6 of them using visual studio code but when I try to constuct an object i always get an error of an incorrect copy constructor in "Ship" class. I humbly ask for help.(the change in this->is because i was trying everything to get it to work)
String^ tekst = MyForm2::textBox1->Text;
int FP = int::Parse(MyForm2::textBox2->Text);
int Armor = int::Parse(MyForm2::textBox3->Text);
int Speed = int::Parse(MyForm2::textBox4->Text);
int AA = int::Parse(MyForm2::textBox5->Text);
int special= int::Parse(MyForm2::textBox6->Text);
int hp = 15;
if (radioButton1->Checked == true)
{
Ship s_1 = Ship (tekst, FP, hp, Armor, Speed, AA);
}
ref class Ship
{
public:
String^ nazwa;
int FP;
int HP;
int ARMOR;
int SPEED;
int AA;
Ship() {};
Ship(String^ new_nazwa, int new_fp, int new_hp, int new_armor, int new_speed,int new_aa)
{
nazwa = new_nazwa;
FP = new_fp;
HP = new_hp;
ARMOR = new_armor;
SPEED = new_speed;
AA = new_aa;
};
};
ref class Destroyer : public Ship
{
public:
Destroyer() {};
Destroyer(String^ new_nazwa, int new_fp, int new_hp, int new_armor, int new_speed, int new_torp,int new_aa)
{
nazwa = new_nazwa;
FP = new_fp;
HP = new_hp;
ARMOR = new_armor;
SPEED = new_speed;
TORP = new_torp;
AA = new_aa;
};
int TORP;
};
ref class Battleship : public Ship
{
public:
Battleship(String^ new_nazwa, int new_fp, int new_hp, int new_armor, int new_speed, int new_sec_fp,int new_aa)
{
this->nazwa = new_nazwa;
this->FP = new_fp;
this->HP = new_hp;
this->ARMOR = new_armor;
this->SPEED = new_speed;
this->Sec_FP = new_sec_fp;
this->AA = new_aa;
};
int Sec_FP;
};
ref class Carrier : public Ship
{
public:
Carrier(String^ new_nazwa, int new_fp, int new_hp, int new_armor, int new_speed, int new_torp,int new_aa)
{
this->nazwa = new_nazwa;
this->FP = new_fp;
this->HP = new_hp;
this->ARMOR = new_armor;
this->SPEED = new_speed;
this->TORP = new_torp;
this->AA = new_aa;
};
int TORP;
};
ref class Cruiser : public Ship
{
public:
Cruiser(String^ new_nazwa, int new_fp, int new_hp, int new_armor, int new_speed, int new_aa)
{
this->nazwa = new_nazwa;
this->FP = new_fp;
this->HP = new_hp;
this->ARMOR = new_armor;
this->SPEED = new_speed;
this->AA = new_aa;
};
};
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…