public abstract class Phone
{
public long Id { get; set; }
protected string Brand;
public abstract string System();
public void Call()
{
Console.WriteLine(
$"use {this.GetType().Name} {this.Brand} {this.System()} Call");
}
public void Photo()
{
Console.WriteLine(
$"use {this.GetType().Name} {this.Brand} {this.System()} Photo");
}
}
public interface IExtend
{
string Remark { get; set; }
void FingerprintPayment();
event Action ea;
}
public class IPhone : Phone, IExtend
{
public IPhone() : base()
{
base.Brand = "Apple";
}
public string Remark { get; set; }
public event Action ea;
public void FingerprintPayment()
{
Console.WriteLine("指纹支付");
}
public override string System()
{
return "IOS";
}
}
public class Redmi : Phone
{
public Redmi()
{
base.Brand = "Redmi";
}
public override string System()
{
return "Android";
}
}
Phone iphone = new IPhone();
iphone.Call();
iphone.Photo();
Phone redmi = new Redmi();
iphone.Call();
iphone.Photo();