c# - Inheritance and interfaces .NET -


quirky question:

imagine have base class called basefoo. have interface methods called ifoo. , have tons of classes beneath basefoo.

if implement interface in basefoo, dont need implement in inherited classes, correct?

ok, imagine have generic function treat ifoo's. need explicitely declare implement ifoo?

like (pseudo-illustrational-code)

public class basefoo:ifoo;  public interface ifoo; 

should this?

public class ambarfoo:basefoo,ifoo 

or?

public class ambarfoo:basefoo 

what correct way? effects same? if test if ambarfoo ifoo get?

thanks

it behave same way regardless. you'd need restate interface name if wanted reimplement interface explicit interface implementation. instance of ambarfoo indeed "say" implements ifoo.


Comments

Popular posts from this blog

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

c++ - Convert big endian to little endian when reading from a binary file -