C#C
C#3y ago
tornixdev

❔ abstract class vs interface

    public interface IFoo
    {
        protected static string GetFormattedTime() => DateTime.Now.ToString("HH:mm");

        public void Foo();
        public void Bar();
    }

    public class Baz : IFoo
    {
        public void Foo() { ... }
        public void Bar() => Console.Writeline(IFoo.GetFormattedTime())
    }
would an abstract class be appropriate here? or would this be just fine?
Was this page helpful?