首页 > 其他 > 详细

go 基础 结构体 接口

时间:2019-05-20 22:02:13      阅读:104      评论:0      收藏:0      [点我收藏+]
package School

type SchoolModel struct {
    Name         string
    Address      string
    StudentCount int
    Is985        bool
}

type ISchoolDal interface {
    GetList()
    Add()
    Delete()
}
package School

type SchoolDal struct {
}

func (o *SchoolDal) GetList() []SchoolModel {

    var result []SchoolModel

    if (result == nil) {

        println("切片是空的")
    }
    var t = SchoolModel{"江西财大", "南昌市", 1000, false}
    var t2 = SchoolModel{"江西财大2", "南昌市", 1000, false}
    result = append(result, t)
    result = append(result, t2)
    return result
}

func (o *SchoolDal) Add(m SchoolModel) {

    println("这里是Add")
}

func (o *SchoolDal) Delete(m SchoolModel) {

    println("这里是Delete")
}

技术分享图片

 

go 基础 结构体 接口

原文:https://www.cnblogs.com/ligenyun/p/10896620.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!