-
Code // Write a project that demonstrates inheritance in C# //note - there are a lot of distinctions between just being unix and linux, but this is a simplified example, I know. public interface IKernel { //TODO - implement basic functions } public abstract class Unix : IKernel { //TODO - implement basic functions } public class WinNT : IKernel { //TODO - implement basic functions } public class LinuxKernel : Unix { } public class XNU : Unix { } public interface IOperatingSystem { public string DE {get; set;} public string WM {get; set;} public IKernel Kernel {get; set;} void outputSystemSettings(); } public abstract class UnixSystem : IOperatingSystem { public IKernel Kernel {get; set;} public string DE {get; set;} public string WM {get; set;} public void outputSystemSettings() {} protected UnixSystem(string DesktopEnvironment, string WindowManager, IKernel kernel) { this.DE = DesktopEnvironment; this.WM = WindowManager; this.Kernel = kernel; } } public class MacOs : UnixSystem { // this info was taken with neofetch on my computer public MacOs() : base("Aqua", "Quartz Compositor", new XNU()) {} } public class Ubuntu : UnixSystem { //defaults are used here, since linux is extremely customizable public Ubuntu() : base("GNOME", "Metacity", new LinuxKernel()) {} } public class Windows : IOperatingSystem { public string DE {get; set;} = "Windows Shell"; public string WM {get; set;} = "DWM"; public IKernel Kernel {get; set;} = new WinNT(); public void outputSystemSettings() { } }
Test Cases Failed namespace Solution { using NUnit.Framework; using System; // TODO: Replace examples and use TDD by writing your own tests [TestFixture] public class SolutionTest { [Test] public void MyTest() { Assert.AreEqual("expected", "actual"); } } }
Output:
-
Code // Write a project that demonstrates inheritance in C#- // Write a project that demonstrates inheritance in C#
- //note - there are a lot of distinctions between just being unix and linux, but this is a simplified example, I know.
- public interface IKernel {
- //TODO - implement basic functions
- }
- public abstract class Unix : IKernel {
- //TODO - implement basic functions
- }
- public class WinNT : IKernel {
- //TODO - implement basic functions
- }
- public class LinuxKernel : Unix {
- }
- public class XNU : Unix {
- }
- public interface IOperatingSystem {
- public string DE {get; set;}
- public string WM {get; set;}
- public IKernel Kernel {get; set;}
- void outputSystemSettings();
- }
- public abstract class UnixSystem : IOperatingSystem {
- public IKernel Kernel {get; set;}
- public string DE {get; set;}
- public string WM {get; set;}
- public void outputSystemSettings() {}
- protected UnixSystem(string DesktopEnvironment, string WindowManager, IKernel kernel) {
- this.DE = DesktopEnvironment;
- this.WM = WindowManager;
- this.Kernel = kernel;
- }
- }
- public class MacOs : UnixSystem {
- // this info was taken with neofetch on my computer
- public MacOs() : base("Aqua", "Quartz Compositor", new XNU()) {}
- }
- public class Ubuntu : UnixSystem {
- //defaults are used here, since linux is extremely customizable
- public Ubuntu() : base("GNOME", "Metacity", new LinuxKernel()) {}
- }
- public class Windows : IOperatingSystem {
- public string DE {get; set;} = "Windows Shell";
- public string WM {get; set;} = "DWM";
- public IKernel Kernel {get; set;} = new WinNT();
- public void outputSystemSettings() {
- }
- }
- All
- {{group.name}} ({{group.count}})
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}