[swift-users] Comparing POP to OOP

Jon Hoffman hoffman.jon at gmail.com
Tue Feb 16 20:58:43 CST 2016


Yes, the method from the concrete type shadows the method from the protocol extension is better terminology.  Thanks for pointing that out.

> On Feb 16, 2016, at 9:49 PM, Dmitri Gribenko <gribozavr at gmail.com> wrote:
> 
> On Tue, Feb 16, 2016 at 6:28 PM, Jon Hoffman via swift-users
> <swift-users at swift.org> wrote:
>> You are correct that if you are using the protocol type to interact with the
>> instance then the method defined in the protocol extension will be called
>> however if it is type casted to a concrete type which has a method that
>> overrides the method in the protocol extension then the method in the
>> concrete type would be called.
> 
> The method in the concrete type does not override the method from the
> protocol extension, it merely shadows that method.
> 
> Dmitri
> 
> -- 
> main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
> (j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/



More information about the swift-users mailing list