Daaaaaaaaaaaaaaaaaaaaaaaaaaaaayum.GyroVorbis wrote:Eh, it's just a different style of OO design.
Saying C++ allowing multiple inheritance is "poor design" is really stupid. There are many extremely useful applications for it. The downsides are that it makes things more complex, and there are ambiguities.
Java, C#, and these "single inheritance, multiple interface" OO languages simply favor a different style. They want you to strictly enforce a difference between interface and implementation.
edit: Especially now that I've spent such a considerable amount of time developing with QT... there are some SERIOUSLY fucking convenient/powerful (though questionable) things you can do with multiple inheritance, some casting, and signals and slots.
Here's a snippit from some toolkit code:Poor design? I'll let you decide. The amount of things that QT now handles for me and the thousands of lines of code I can save with this kind of abuse and some clever casting is so fucking worth it.Code: Select all
class Entity: public QWidget, public TreeNode, public QGraphicsRectItem, AssetManager {
Multiple inheritance
Moderator: Coders of Rage
Re: Multiple inheritance
- Ginto8
- ES Beta Backer
- Posts: 1064
- Joined: Tue Jan 06, 2009 4:12 pm
- Programming Language of Choice: C/C++, Java
Re: Multiple inheritance
Touche. I guess when you have a good framework it's ok Tho it must be admitted that this is the exception, not the norm, and there are a lot of cases where it just makes things messier rather than easier.GyroVorbis wrote:Eh, it's just a different style of OO design.
Saying C++ allowing multiple inheritance is "poor design" is really stupid. There are many extremely useful applications for it. The downsides are that it makes things more complex, and there are ambiguities.
Java, C#, and these "single inheritance, multiple interface" OO languages simply favor a different style. They want you to strictly enforce a difference between interface and implementation.
edit: Especially now that I've spent such a considerable amount of time developing with QT... there are some SERIOUSLY fucking convenient/powerful (though questionable) things you can do with multiple inheritance, some casting, and signals and slots.
Here's a snippit from some toolkit code:Poor design? I'll let you decide. The amount of things that QT now handles for me and the thousands of lines of code I can save with this kind of abuse and some clever casting is so fucking worth it.Code: Select all
class Entity: public QWidget, public TreeNode, public QGraphicsRectItem, AssetManager {
Quit procrastinating and make something awesome.
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
- adikid89
- Chaos Rift Cool Newbie
- Posts: 94
- Joined: Tue Apr 27, 2010 6:59 am
- Current Project: small tiny-mini projects
- Favorite Gaming Platforms: PC I guess...
- Programming Language of Choice: c++
Re: Multiple inheritance
*confused* ... so... entities are entire widgets? Why :D ? And what's with the private inheriting of the AssetManager? I'm just confused ... care to shed some light on that line of code pls? I can't tell what's going on... and I'm pretty curious, as I've never really encountered a useful application of multiple inheritance.GyroVorbis wrote:Code: Select all
class Entity: public QWidget, public TreeNode, public QGraphicsRectItem, AssetManager {
My first game C++/SDL Yoshi Combat! = http://www.youtube.com/watch?v=HQ9mMBEWSZg
==============================================================
==============================================================
- dandymcgee
- ES Beta Backer
- Posts: 4709
- Joined: Tue Apr 29, 2008 3:24 pm
- Current Project: https://github.com/dbechrd/RicoTech
- Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
- Programming Language of Choice: C
- Location: San Francisco
- Contact:
Re: Multiple inheritance
My understanding is that Entity inherits QWidget because entities are widgets in the ES Toolkit. I believe they inherit from AssetManager in order to have a pointer to the manager. I'll let Falco confirm and/or explain what is actually going on in more detail.adikid89 wrote:*confused* ... so... entities are entire widgets? Why :D ? And what's with the private inheriting of the AssetManager? I'm just confused ... care to shed some light on that line of code pls? I can't tell what's going on... and I'm pretty curious, as I've never really encountered a useful application of multiple inheritance.GyroVorbis wrote:Code: Select all
class Entity: public QWidget, public TreeNode, public QGraphicsRectItem, AssetManager {
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!
- Falco Girgis
- Elysian Shadows Team
- Posts: 10294
- Joined: Thu May 20, 2004 2:04 pm
- Current Project: Elysian Shadows
- Favorite Gaming Platforms: Dreamcast, SNES, NES
- Programming Language of Choice: C/++
- Location: Studio Vorbis, AL
- Contact:
Re: Multiple inheritance
Yes, and yes. The QGraphicsRectItem is the physically rendered entity.dandymcgee wrote:My understanding is that Entity inherits QWidget because entities are widgets in the ES Toolkit. I believe they inherit from AssetManager in order to have a pointer to the manager. I'll let Falco confirm and/or explain what is actually going on in more detail.adikid89 wrote:*confused* ... so... entities are entire widgets? Why :D ? And what's with the private inheriting of the AssetManager? I'm just confused ... care to shed some light on that line of code pls? I can't tell what's going on... and I'm pretty curious, as I've never really encountered a useful application of multiple inheritance.GyroVorbis wrote:Code: Select all
class Entity: public QWidget, public TreeNode, public QGraphicsRectItem, AssetManager {
Re: Multiple inheritance
Boy that's nuts, even though I can understand how that's implemented. I usually put pointers to managers within the class i.e. composition. At one point I had a base entity class have a manager as a friend class, but the manager would probably have too much power over editing the entities.
- GroundUpEngine
- Chaos Rift Devotee
- Posts: 835
- Joined: Sun Nov 08, 2009 2:01 pm
- Current Project: mixture
- Favorite Gaming Platforms: PC
- Programming Language of Choice: C++
- Location: UK
Re: Multiple inheritance
My sentiments exactly!N64vSNES wrote:Daaaaaaaaaaaaaaaaaaaaaaaaaaaaayum.GyroVorbis wrote:Eh, it's just a different style of OO design.
Saying C++ allowing multiple inheritance is "poor design" is really stupid. There are many extremely useful applications for it. The downsides are that it makes things more complex, and there are ambiguities.
Java, C#, and these "single inheritance, multiple interface" OO languages simply favor a different style. They want you to strictly enforce a difference between interface and implementation.
edit: Especially now that I've spent such a considerable amount of time developing with QT... there are some SERIOUSLY fucking convenient/powerful (though questionable) things you can do with multiple inheritance, some casting, and signals and slots.
Here's a snippit from some toolkit code:Poor design? I'll let you decide. The amount of things that QT now handles for me and the thousands of lines of code I can save with this kind of abuse and some clever casting is so fucking worth it.Code: Select all
class Entity: public QWidget, public TreeNode, public QGraphicsRectItem, AssetManager {