Skip to content

Instantly share code, notes, and snippets.

@ewilazarus
Last active August 29, 2015 14:25
Show Gist options
  • Save ewilazarus/e90c51380d196c98f5f4 to your computer and use it in GitHub Desktop.
Save ewilazarus/e90c51380d196c98f5f4 to your computer and use it in GitHub Desktop.
public class Markuper
{
public virtual string execute(string content)
{
return content;
}
}
public class H1Markuper : Markuper
{
public string execute(string content)
{
return "<h1>" + super.execute(content) + "</h1>";
}
}
public class PMarkuper : Markuper
{
public string execute(string content)
{
return "<p>" + super.execute(content) + "</p>";
}
}
public class Program
{
var h1Markuper = new H1Markuper();
Console.WriteLine(h1Markuper.execute("This is my header"));
// <h1>This is my header</h1>
var pMarkuper = new PMarkuper();
Console.WriteLine(pMarkuper.execute("This is my paragraph"));
// <p>This is my paragraph</p>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment