On 05/24/2010 06:36 PM, Ali Çehreli wrote:
Ali Çehreli wrote:
"Conditional Expressions" on this page covers the ternary operator as
well:

http://digitalmars.com/d/2.0/expression.html#ConditionalExpression

It says "the second and third expressions are implicitly converted to
a common type which becomes the result type of the conditional
expression."

How "common" should the "common type" be? Wouldn't you expect the
following ternary operator's result be I, instead of Object?

interface I {}
class A : I {}

My expectation is that the hierarchy of A should look like this:

Object
|
I
|
A

interfaces are not objects, so crush your expectations.

Question: what should happen with

class A : I, J {}
class B : I, J {}

?

Reply via email to