sample code is:
struct Point {
x int
y int
}
struct Point3D {
Point
z int
}
it compile faild,just panic
Embedding structs is not implemented yet.
This feature may cause confusion
This feature may cause confusion
Totally Agreed! Need some style to make it happen.
It's one of the specs of Go.
So V is Go++?
What if we have x in both 馃馃樁.
confusion
Keeb V simple.
Embedding works really well in Go and allows to migrate OOP code easier.
The name conflict is handled pretty easily:
So V is Go++?
of course a better go or better c, but not go++.
struct point {
x int
y int
}
struct point3d {
p point
z int
}
This is now the structure.
@Bowero embedded structs are not implemented yet.
Embedding works really well in Go and allows to migrate OOP code easier.
The name conflict is handled pretty easily:
Somehow this example looks wrong and I wonder why it compiles and how the second output value can be "0" (it is never assigned to A), in my view a correct example would look rather like:
https://play.golang.org/p/8Qo6vzWs0px
Closed. Struct embedding was (initially) implemented in https://github.com/vlang/v/commit/2c75b1397cbd8b940bdf357ebb74d59660c53f51.
Most helpful comment
This feature may cause confusion