File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -388,7 +388,7 @@ For interfaces that are strictly single-inheritance (each interface in the inher
388
388
>
389
389
> interface ICounter
390
390
> {
391
- > void Count ( int i );
391
+ > int Count { get ; set ; }
392
392
> }
393
393
>
394
394
> interface IListCounter : IList , ICounter {}
@@ -397,15 +397,14 @@ For interfaces that are strictly single-inheritance (each interface in the inher
397
397
> {
398
398
> void Test (IListCounter x )
399
399
> {
400
- > x .Count (1 ); // Error
401
- > x .Count = 1 ; // Error
402
- > ((IList )x ).Count = 1 ; // Ok, invokes IList.Count.set
403
- > ((ICounter )x ).Count (1 ); // Ok, invokes ICounter.Count
400
+ > x .Count = 1 ; // Error
401
+ > ((IList )x ).Count = 1 ; // Ok, invokes IList.Count.set
402
+ > ((ICounter )x ).Count = 1 ; // Ok, invokes ICounter.Count
404
403
> }
405
404
> }
406
405
> ```
407
406
>
408
- > the first two statements cause compile - time errors because the member lookup ([§12 . 5 ](expressions .md #125 - member - lookup )) of `Count ` in `IListCounter ` is ambiguous . As illustrated by the example , the ambiguity is resolved by casting `x ` to the appropriate base interface type . Such casts have no run -time costs —they merely consist of viewing the instance as a less derived type at compile -time .
407
+ > the first statement causes a compile - time error because the member lookup ([§12 . 5 ](expressions .md #125 - member - lookup )) of `Count ` in `IListCounter ` is ambiguous . As illustrated by the example , the ambiguity is resolved by casting `x ` to the appropriate base interface type . Such casts have no run -time costs —they merely consist of viewing the instance as a less derived type at compile -time .
409
408
>
410
409
> *end example *
411
410
<!-- markdownlint -disable MD028 -->
You can’t perform that action at this time.
0 commit comments