4 ms·
I don't think you really understood the Go example. In C if I have: struct SuperClass { int foo; }; struct SubClass { struct SuperC
by mdwrigh2 14y ago
I don't think you really understood the Go example. In C if I have:
struct SuperClass {
int foo;
};
struct SubClass {
struct SuperClass super;
};
Then to set the foo item I'd have to do:
struct SubClass bar;
bar.super.foo = 5;
Whereas in Go I could say:
type SuperClass struct {
foo int
}
type SubClass struct {
SuperClass
}
bar := SubClass{}
bar.foo = 5
So, small difference, but I think valid.