4 ms·
This is similar to C++ in which base class methods are 'virtual'. Is there a way to stop this behaviour? Just thinking how non-virtual methods can be implemente
by shared4you 13y ago
This is similar to C++ in which base class methods are 'virtual'. Is there a way to stop this behaviour? Just thinking how non-virtual methods can be implemented then. C++ has a keyword, 'virtual', for switching this behaviour, but any analogue in Go?
- voidlogic 13y agoYou mean like final in Java? I don't believe there is. Go has a different way of handling OO and so far I have never needed "final". In Go embedding is not common and interfaces are used much more. In Go, having final in an embedded struct affect the containing struct seems wrong IMHO- this would allow embeded fields to dictate the behaviour of things that embed them. I don't think most programmers would be happy with adding a field to a struct and as a consequence be prevented from implementing a given method signature.
- shared4you 13y agoAh sorry, I have no idea about Java or final, so ... can't comment.
- voidlogic 13y agohttp://en.wikipedia.org/wiki/Final_%28Java%29#Final_methods http://en.wikipedia.org/wiki/Final_%28Java%29#Final_methods