If i have 2 classes One for data, for example:
public class Cords
{
public double x;
public double y;
}
and one, that using this data:
public class Geometry
{
public Cords()
{
points = new List<Cords>();
}
public void SomeMathWithPoints()
{
MagicWithPoints(points);
}
protected List<Cords> points;
}
And i want to exted this class with some specific functions, using inheritance, but this time i need some aditional data for Cords class. So i'm trying to do it this way:
public class ExtendedCords: Cords
{
public double x;
public double y;
public string name;
}
public class ExtendedGeometry : Geometry
{
protected SomeNewMagicWithPoints(){...}
protected List<ExtendedCords> points;
}
But i've noticed, that if i will do:
ExtendedGeometry myObject = new ExtendedGeometry();
myObject.SomeMathWithPoints();
This function will be using old (parrents) field points
. So how can i make it use the new one with a type ExtendedCords
? I mean, i want to be able to use both child's and parrent's functions on a new field.