c# - Interfaces - Implement abstract class methods -


i'm not sure how ask question, want access abstract methods idog. consider this:

    static void main(string[] args)     {         idog dog = new dog();         dog.catchfrisbee();         dog.speak("bark") // error -> no implementation         console.readline();     }      public class dog : animal, idog     {         public void catchfrisbee()         {             console.writeline("dog catching frisbee");         }     }     public abstract class animal : ianimal     {         public void speak(string saywhat)         {             console.writeline(saywhat);         }          public void die()         {             console.writeline("no longer exists");         }     }     public interface idog     {         void catchfrisbee();     }     public interface ianimal     {         void die();          void speak(string saywhat);     } 

from static void main, able call dog.speak() can't because it's not implemented in idog. know can access speak() derived classes possible access implemenation or bad design?

assuming idogs ianimals, declare idog implementing ianimal

public interface idog : ianimal 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -