Czy taka kombinacja jest okej?
Staram się ograniczyć powielanie kodu nawet w metodach tej samej klasy więc metoda A używa metody B. Czy to dobre rozwiązanie?
public interface IView
{
void Clear();
void Clear(Point point);
void Draw(object obj, Point point);
void Draw(object obj, Point point, object color);
}
public class ConsoleView : IView
{
public void Clear() => Console.Clear();
public void Clear(Point point) => this.Draw(' ', point);
public void Draw(object obj, Point point) => this.Draw(obj, point, ForegroundColor);
public void Draw(object obj, Point point, object color)
{
ForegroundColor = (ConsoleColor)color;
SetCursorPosition(point.X, point.Y);
Write(obj.ToString());
}
}