using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp32
{
class Program
{
static void Main(string[] args)
{
var child = new Child(60);
Console.Read();
}
}
public class Parent
{
public Parent(string args)
{
Console.WriteLine(args);
}
}
public class Child : Parent
{
public Child(int i) : base (JudgeValue(i))
{
}
private static string JudgeValue(int value)
{
if (value >= 60)
{
return "及格";
}
else
{
return "不及格";
}
}
}
}
C#编程,继承,条件判断,及格,不及格
学习C#编程中继承和构造函数的应用,通过实例理解如何使用继承和构造函数传递参数,并根据条件判断输出结果。