添加Lesson14和Lesson15
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<RootNamespace>Lesson15_继承_万物之父和装箱拆箱练习</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,19 @@
|
||||
namespace Lesson15_继承_万物之父和装箱拆箱练习
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("Hello, World!");
|
||||
//用代码演示拆箱装箱
|
||||
|
||||
//装箱
|
||||
int i = 10;
|
||||
object o1 = i;
|
||||
|
||||
//拆箱
|
||||
object o2 = o1;
|
||||
int i2 = (int)o2;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user