Comments (5)
windows上似乎有bug. 不支持匿名组合的方法继承。 go2o 是在mac下开发的,
跟windows有些不同,建议在非windows下使用。
from go2o.
type Base struct {
...
}
func (base *Base) Bar() { ... }
type Foo struct {
Base
...
}
func (foo *Foo) Bar() {
foo.Base.Bar()
...
}
据我有限的知识, 匿名组合继承的方式是上面这种, 可是在web_c.go, base_c.go中,类的名字完全一样,方法的声明也完全一样,且都属于www包, 从逻辑上讲, 如果我声明一个baseC类去调用GetPartnerId, 我该调用哪个呢(base_c.go 还是 web_c.go里的GetPartnerId)?
from go2o.
web_c.go 中调用GetPartnerId ,前提是web_c.go没有定义GetPartnerId。
如果有的话,相当于重写了。执行的是web_c.go 里的实现。
这处代码是gof里web 筛选器的应用,这里有个示例代码:
https://github.com/atnet/gof/blob/master/web/demo/web_demo.go
from go2o.
谢谢 .
web_c.go 中调用GetPartnerId ,前提是web_c.go没有定义GetPartnerId。
如果有的话,相当于重写了。执行的是web_c.go 里的实现。
这个我明白, 但是
type listC struct {
*baseC
}
如果list_c.go 中的listC类调用了GetPartner,那么调用了web_c.go还是base_c.go中的呢? 我怎么可以看出web_c.go 中的GetPartner重写了base_c.go中的GetPartner , 而不是 base_c.go 中的GetPartner重写了web_c.go中的GetPartner?
他们的继承关系是怎么决定的,有什么原则吗?
from go2o.
我好像晕了,这我说不上来。这个在网上没有相关介绍的。
原则基本上是遵循OO的吧
from go2o.
Related Issues (20)
- front project HOT 1
- 代码优化
- 调整商品分类
- 调整获取商户运费模板
- 购物车取消与商户关联,改为与店铺关联
- RegistryService
- 数据库的表不全 HOT 8
- 调整商品模型表名
- 删除模型的规格和属性后报错
- 商户登录密码错误提示 商户不存在
- 服务分页参数不支持多个排序条件
- 添加收货地址及地区的接口
- go2o-web docker-compose is broken HOT 1
- 有没有解释项目架构的文章? HOT 2
- 求讲解 HOT 1
- 关于支付 HOT 1
- 2020-10-07 11:26:11 HOT 1
- 一直部署不成功 HOT 1
- 后台界面代码可以提供吗? HOT 7
- 支持POS 收银
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go2o.