Initial commit
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.14.36518.9 d17.14
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp5", "ConsoleApp5.csproj", "{385129E7-4999-45F9-B4C2-5B7957256DD1}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{385129E7-4999-45F9-B4C2-5B7957256DD1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{385129E7-4999-45F9-B4C2-5B7957256DD1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{385129E7-4999-45F9-B4C2-5B7957256DD1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{385129E7-4999-45F9-B4C2-5B7957256DD1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {E72836AD-CDD7-4AC4-B788-ADC6A53519E0}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,32 @@
|
||||
namespace ConsoleApp5
|
||||
{
|
||||
public class Person
|
||||
{
|
||||
public string name;
|
||||
protected int age;
|
||||
public Person()
|
||||
{
|
||||
this.name = "未知"; this.age = 0;
|
||||
}
|
||||
public Person(string name, int age)
|
||||
{
|
||||
this.name = name; this.age = age;
|
||||
}
|
||||
public void Print()
|
||||
{
|
||||
Console.WriteLine("name = {0}, age = {1}", this.name, this.age);
|
||||
}
|
||||
}
|
||||
class Persontest2
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Person personA;
|
||||
personA = new Person("张三", 25);
|
||||
Person personB;
|
||||
personB = new Person("李四", 18);
|
||||
personA.Print();
|
||||
personB.Print();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user