lesson12练习更改
This commit is contained in:
@@ -90,7 +90,7 @@
|
||||
|
||||
|
||||
ChineseTeacher ct = new ChineseTeacher();
|
||||
ct.name = "唐老师";
|
||||
ct.name = "HK";
|
||||
ct.number = 2;
|
||||
ct.subject = "语文";
|
||||
ct.SpeakName();
|
||||
|
||||
@@ -11,10 +11,9 @@
|
||||
}
|
||||
class Warrior : Human
|
||||
{
|
||||
public int atk;
|
||||
public void Attack()
|
||||
public void Attack(Warrior OtherWarrior)
|
||||
{
|
||||
Console.WriteLine("攻击");
|
||||
Console.WriteLine("{0}攻击{1}",name,OtherWarrior.name);
|
||||
}
|
||||
}
|
||||
internal class Program
|
||||
@@ -24,11 +23,10 @@
|
||||
Console.WriteLine("Hello, World!");
|
||||
Warrior w = new Warrior();
|
||||
w.name = "HK";
|
||||
w.age = 18;
|
||||
w.Speak();
|
||||
w.atk = 5;
|
||||
w.Attack();
|
||||
|
||||
Warrior w2 = new Warrior();
|
||||
w2.name = "KH";
|
||||
w2.Attack(w);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user