abstract class TestAbstarctClass
{
public string sameTextValue = "Abstact text";
public virtual string Name
{
get { return sameTextValue; }
set { sameTextValue = value; }
}
public string testFF()
{
return sameTextValue;
}
}
class Concrete1TestClass : TestAbstarctClass
{
new public string sameTextValue = "Concrete1 text";
public override string Name
{
get { return sameTextValue; }
set { sameTextValue = value; }
}
}
class Concrete2TestClass : TestAbstarctClass
{
new public string sameTextValue = "Concrete2 text";
}
class Tester
{
public void getText(TestAbstarctClass item)
{
Debug.Log(item.sameTextValue + " / " + item.Name + " / " + item.testFF());
}
}
////////////////////////////
Tester t = new Tester();
t.getText(new Concrete1TestClass()); //Abstact text / Concrete1 text / Abstact text
t.getText(new Concrete2TestClass()); //Abstact text / Abstact text / Abstact text
Concrete2TestClass cl2 = new Concrete2TestClass();
Debug.Log(cl2.sameTextValue + " / " + cl2.Name + " / " + cl2.testFF()); //Concrete2 text / Abstact text / Abstact text