class Contact { string bgColor() { return "Серый"; } } class Friend : Contact { string currentBgColor = "Светло-зеленый"; string currentReminder; this(ref string c) { currentBgColor = c; } override string bgColor() { return currentBgColor; } string reminder() { return currentReminder; } } unittest { string startColor = "Синий"; Friend f = new Friend(startColor); Contact c = f; // Подставить экземпляр класса Friend вместо экземпляра класса Contact auto color = c.bgColor(); // Вызвать метод класса Friend import std.stdio : writeln; writeln(color); }