D
David
i've abstract class Weight
public abstract class Weight
{
public int Quantity; // how much it weigths
}
and then i created 3 derived classes: Kilogram, Gram and Milligram
in each of them i created an implicit operator to convert from one to
another...
it works fine...
then in each of them is 3 constructors, one takes "Quantity" from int value,
and two others from other clsses, like for kilogram it would be milligram
and gram.
then i tryed to overload operator + for each of them...
and here troubles begin...
C# can't choose wich operator overload to use +, implicit, constructor...
a mess, i should say...
how this can be solved
thnx...
public abstract class Weight
{
public int Quantity; // how much it weigths
}
and then i created 3 derived classes: Kilogram, Gram and Milligram
in each of them i created an implicit operator to convert from one to
another...
it works fine...
then in each of them is 3 constructors, one takes "Quantity" from int value,
and two others from other clsses, like for kilogram it would be milligram
and gram.
then i tryed to overload operator + for each of them...
and here troubles begin...
C# can't choose wich operator overload to use +, implicit, constructor...
a mess, i should say...
how this can be solved
thnx...