This commit is contained in:
2025-09-08 12:32:22 +08:00
parent 3724bc0ad5
commit d9135dc3d4
5 changed files with 95 additions and 0 deletions
+6
View File
@@ -11,6 +11,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lesson10_封装-运算符
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lesson11_内部类和分部类", "Lesson11_内部类和分部类\Lesson11_内部类和分部类.csproj", "{51A60C77-3609-42BD-B0D9-83E1B61B6E69}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lesson12_继承-继承的基本概念练习", "Lesson12_继承_继承的基本概念练习\Lesson12_继承-继承的基本概念练习.csproj", "{DD7B30CE-773B-4752-9703-D0D5E6E4F376}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -33,6 +35,10 @@ Global
{51A60C77-3609-42BD-B0D9-83E1B61B6E69}.Debug|Any CPU.Build.0 = Debug|Any CPU
{51A60C77-3609-42BD-B0D9-83E1B61B6E69}.Release|Any CPU.ActiveCfg = Release|Any CPU
{51A60C77-3609-42BD-B0D9-83E1B61B6E69}.Release|Any CPU.Build.0 = Release|Any CPU
{DD7B30CE-773B-4752-9703-D0D5E6E4F376}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DD7B30CE-773B-4752-9703-D0D5E6E4F376}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DD7B30CE-773B-4752-9703-D0D5E6E4F376}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DD7B30CE-773B-4752-9703-D0D5E6E4F376}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Lesson12_继承_继承的基本概念练习</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>
@@ -0,0 +1,34 @@
namespace Lesson12_继承_继承的基本概念练习
{
class Human
{
public string name;
public int age;
public void Speak()
{
Console.WriteLine("说话");
}
}
class Warrior : Human
{
public int atk;
public void Attack()
{
Console.WriteLine("攻击");
}
}
internal class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello, World!");
Warrior w = new Warrior();
w.name = "HK";
w.age = 18;
w.Speak();
w.atk = 5;
w.Attack();
}
}
}
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>
@@ -0,0 +1,34 @@
namespace Lesson12_继承_继承的基本概念练习
{
class Human
{
public string name;
public int age;
public void Speak()
{
Console.WriteLine("说话");
}
}
class Warrior : Human
{
public int atk;
public void Attack()
{
Console.WriteLine("攻击");
}
}
internal class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello, World!");
Warrior w = new Warrior();
w.name = "HK";
w.age = 18;
w.Speak();
w.atk = 5;
w.Attack();
}
}
}