Last active
May 2, 2017 20:47
-
-
Save propagated/07cce05e7520238478c8561ef705cf4d to your computer and use it in GitHub Desktop.
Basic inheritance model for injected objects
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
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