Composition over inheritance: Difference between revisions

Content deleted Content added
No edit summary
Line 282:
Some languages provide specific means to mitigate this:
 
* [[C Sharp (programming language)|C#]] provides default interface methods since 8.0 version which allows to define body to interface member. <ref>{{cite web | url=https://docs.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-8#default-interface-methods | title=What's new in C# 8.0 | website=Microsoft Docs | publisher=Microsoft | access-date=2019-02-20}}</ref>
* [[D (programming language)|D]] provides an explicit "alias this" declaration within a type can forward into it every method and member of another contained type. <ref>{{cite web | url=https://dlang.org/spec/class.html#alias-this | title=Alias This | website=D Language Reference| access-date=2019-06-15}}</ref>
* [[Dart (programming language)|Dart]] provides mixins with default implementations that can be shared.
* [[Go (programming language)|Go]] type embedding avoids the need for forwarding methods.<ref>{{cite web | url=https://golang.org/doc/effective_go.html#embedding | title=''(Type)'' Embedding | website=The Go Programming Language Documentation | access-date=2019-05-10}}</ref>