The Go Programming Language
› http://golang.org/
› Go Playground
Go Projects
› Revel Web Framework
yakczh

go语言为什么没有继承?

  •  
  •   yakczh · Jan 2, 2013 · 4314 views
    This topic created in 5063 days ago, the information mentioned may be changed or developed.
    看了一下其他方面都很不错,但没有继承,光有接口的话,那相同的类属性,是不是都要重复声明?
    6 replies  •  1970-01-01 08:00:00 +08:00
    reusFork
    reusFork
    Jan 2, 2013
    1
    不需要,因为有embedded struct
    raspberry
    raspberry
    Jan 2, 2013
    2
    struct有匿名字段可用
    notedit
    notedit
    Jan 2, 2013
    3
    type A struct {
    }

    type B struct {
    A
    }
    wildchild
    wildchild
    Jan 2, 2013
    4
    细追究它还没有类呢,呵呵,实现面向对象的不同方式了。
    daweiba
    daweiba
    Jan 3, 2013
    5
    3楼正解
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2427 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 40ms · UTC 10:39 · PVG 18:39 · LAX 02:39 · JFK 05:39
    ♥ Do have faith in what you're doing.