Skip to content

Instantly share code, notes, and snippets.

@carmeleve
Last active October 12, 2020 09:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carmeleve/da7cf32b8b226cee942bf703dfbe177c to your computer and use it in GitHub Desktop.
Save carmeleve/da7cf32b8b226cee942bf703dfbe177c to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Text;
namespace DesignPatterns.Adapter
{
public class TriceratopsToMammalAdapter : IMammal
{
private readonly Triceratops triceratops;
public TriceratopsToMammalAdapter(Triceratops triceratops)
{
this.triceratops = triceratops;
}
public IChild GiveBirth()
{
TriceratopsEgg egg = triceratops.LayEgg();
IChild child = egg.Hatch();
return child;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment