Skip to content

Instantly share code, notes, and snippets.

@chrisza4
Created July 27, 2019 01:32
Show Gist options
  • Select an option

  • Save chrisza4/d867713eb324935fbe8c9d0d2ffb6832 to your computer and use it in GitHub Desktop.

Select an option

Save chrisza4/d867713eb324935fbe8c9d0d2ffb6832 to your computer and use it in GitHub Desktop.
// 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