Hacker News new | ask | show | jobs
by u14408885 3801 days ago
Whenever I hear of a golang binding to a library implemented in C++ I'm always interested to see how they map the class hierarchy to golang's type model which doesn't have traditional inheritence.

Does QT's class hierarchy map cleanly to Go? Is it just interfaces everywhere?

(I'm not trying to start a language war, just genuinely curious.)

1 comments

So it uses interfaces and anonymous fields. So if you are familiar with Qt, something like QPushButton would be implemented in go by having an anonymous field for QAbstractButton which would have an anonymous field for QWidget. Furthermore, this class has to implement an interface so it can be passed around like a normal QWidget in C++ would.

That was kind of a ramble, but thats the gist of it.