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

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

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -