摘要:        
main.go package main import ( "fmt" "github.com/面向对象编程/面向对象编程思想/封装/model" ) /* 封装(encapsulation)就是把抽象出的字段和字段的操作封装在一起, 数据被保护在内部,程序的其他包只有通过被授权的操作,才能对字段进    阅读全文
posted @ 2022-03-09 14:49
Star_Gazer
阅读(120)
评论(0)
推荐(0)
        
            
        
        
摘要:        
package main import "fmt" //定义结构体的时候,实际上就是把一类失误的共有属性和行为提取出来,形成一个物理模型 //定义一个Account结构体 type Account struct { AccountNo string Pwd int Balance float64 }    阅读全文
posted @ 2022-03-09 13:57
Star_Gazer
阅读(39)
评论(0)
推荐(0)
        
            
        
        
摘要:        
访问私有字段 main.go package main import ( "fmt" "github.com/面向对象编程/工厂模式/model" ) func main() { // var stu = model.Student{ // Name: "tom", // Score: 78.9,     阅读全文
posted @ 2022-03-09 13:34
Star_Gazer
阅读(34)
评论(0)
推荐(0)
        

 浙公网安备 33010602011771号
浙公网安备 33010602011771号