Skip to content

Instantly share code, notes, and snippets.

@propagated
Last active May 2, 2017 20:47
Show Gist options
  • Save propagated/07cce05e7520238478c8561ef705cf4d to your computer and use it in GitHub Desktop.
Save propagated/07cce05e7520238478c8561ef705cf4d to your computer and use it in GitHub Desktop.
Basic inheritance model for injected objects
namespace example
{
class Product
{
public string ProductName { get; set; }
public string Text { get; set; }
}
class FileXChange : Product
{
public FileXChange()
{
ProductName = "File XChange";
Text = "Select Search";
}
}
class hellomike
{
private string prod;
private string text;
private hellomike()
{
setupTheShit();
}
public hellomike(Product product) : this()
{
setValues(product);
}
void setValues(Product prod)
{
this.prod = prod.ProductName;
this.text = prod.Text;
}
void setupTheShit()
{ }
}
class main
{
void Main()
{
var hello = new hellomike(new Product() { Text = "silly times", ProductName = "Sandwiches inc."});
var hello2 = new hellomike(new FileXChange());
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment