The "Default Interface Methods" (DIM) is now the longest thread of C# proposal
-
Default methods, great idea. If they switch .net to use binary interfaces this could be implemented by placing the default method at a pre-defined location of the interface, maybe the fourth entry in the interface so it's all standardised.
-
If they want to add methods to interfaces, and if that doesn't break the multiple interface inheritance feature, why can't we inherit multiple classes as well?
".45 ACP - because shooting twice is just silly" - JSOP, 2010
-----
You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
-----
When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013 -
Yay, a new abstraction layer. Just what I needed in my day; not like I don't find myself editing out all the ones I inadvertently add already during the initial overthink. One day I should get YAGNI tattooed on the back of my hand :/
"Never attribute to malice that which can be explained by stupidity." - Hanlon's Razor
-
If they want to add methods to interfaces, and if that doesn't break the multiple interface inheritance feature, why can't we inherit multiple classes as well?
".45 ACP - because shooting twice is just silly" - JSOP, 2010
-----
You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
-----
When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013John Simmons / outlaw programmer wrote:
why can't we inherit multiple classes as well?
Because classes can have data and then you have diamond problem...
-
John Simmons / outlaw programmer wrote:
why can't we inherit multiple classes as well?
Because classes can have data and then you have diamond problem...
It wasn't a "problem" in C++ - just sayin...
".45 ACP - because shooting twice is just silly" - JSOP, 2010
-----
You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
-----
When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013 -
It wasn't a "problem" in C++ - just sayin...
".45 ACP - because shooting twice is just silly" - JSOP, 2010
-----
You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
-----
When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013Many things weren't "problems" in C++, but I doubt C# designers want to take this route :)
-
It wasn't a "problem" in C++ - just sayin...
".45 ACP - because shooting twice is just silly" - JSOP, 2010
-----
You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
-----
When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013It was much worse than a problem - it was a complication. If you've ever implemented COM in C++ or non-trivial owner-draw for MFC you have to be very aware of the complexities of multiple inheritance. I've done a lot of programming with C# over the last ten years. There have only been a couple of times where something would have been more concise using multiple inheritance, rather than single inheritance and multiple interfaces.
Software Zen:
delete this;
-
It was much worse than a problem - it was a complication. If you've ever implemented COM in C++ or non-trivial owner-draw for MFC you have to be very aware of the complexities of multiple inheritance. I've done a lot of programming with C# over the last ten years. There have only been a couple of times where something would have been more concise using multiple inheritance, rather than single inheritance and multiple interfaces.
Software Zen:
delete this;
In MFC, you could only multiple inherit if only one of the classes being inherited was not derived from
CObject
. The reason it can't be done in .Net is that ALL objects are inherited fromObject
, and there's no way to avoid it. They could easily fix it with an attribute, but no, they'd rather adhere to their arbitrary restrictions.".45 ACP - because shooting twice is just silly" - JSOP, 2010
-----
You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
-----
When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013