C#中接口定义属性如下所示: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Ch08Ex05 { abstract class HotDrink { float Milk; float Sugar; public int Drink(int x); public int AddMilk(int x); public int AddSugar(int x…
一.接口定义 1.定义 interface类型可以定义一组方法,但是这些不需要实现,并且interface不能包含任何变量 package main import ( "fmt" ) type test interface{ print() } type Student struct{ name string age int score int } func (p *Student)print(){ fmt.Println("name",p.name) fmt.Pr…