S
Sacha Faust
I have an abstract class, RuleResponse, and then create a new class base on
it, RuleResponseSequence, and override the ++ operater.
If I try to cast a RuleResponse as a RuleResponseSequence and try to use the
++ operator the compiler tells me "The left-hand size of an assignment must
be a variable, property or indexer". I don't understand why I get that. Here
is the line that doesn't compile (m_rule.Response is a RuleResponse
instance):
((RuleResponseSequence)m_rule.Response)++;
But if I write the following code, it compiles file:
RuleResponseSequence a = (RuleResponseSequence)m_rule.Response; a++;
I would like to know if this is a "bug" or if C# handles cast differently.
Tks.
it, RuleResponseSequence, and override the ++ operater.
If I try to cast a RuleResponse as a RuleResponseSequence and try to use the
++ operator the compiler tells me "The left-hand size of an assignment must
be a variable, property or indexer". I don't understand why I get that. Here
is the line that doesn't compile (m_rule.Response is a RuleResponse
instance):
((RuleResponseSequence)m_rule.Response)++;
But if I write the following code, it compiles file:
RuleResponseSequence a = (RuleResponseSequence)m_rule.Response; a++;
I would like to know if this is a "bug" or if C# handles cast differently.
Tks.