Created
July 27, 2019 01:32
-
-
Save chrisza4/d867713eb324935fbe8c9d0d2ffb6832 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Inheritance | |
| namespace Test | |
| { | |
| class AutoMobile | |
| { | |
| } | |
| class Car: AutoMobile | |
| { | |
| } | |
| } | |
| // Composition | |
| namespace Test2 | |
| { | |
| interface IAutoMobile { } | |
| class AutoMobile: IAutoMobile { } | |
| class Car: IAutoMobile | |
| { | |
| private AutoMobile mobile = null; | |
| public Car() | |
| { | |
| mobile = new AutoMobile(); | |
| } | |
| public void Method1 () | |
| { | |
| this.mobile.Method1(); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment