I need to create a course management system with course categories:
Cooking, sewing and writing courses
cooking and writing each has 2 courses (Italian, seafood, creative writing and business writing). This creates a derivative abstract:
abstract course -> abstract cooking -> concrete seafood
Abstract cooking and writing have common fields and some common methods, however they also have abstract methods that are abstract in the base class.
Can this be done in C #? If I create abstract methods of abstract classes, then Visual Studio says that they hide the abstract paragraph of the base class, and then the concrete methods of the class have errors saying that the base class must be abstract (it should not be registered). I was looking for an answer. I know that one single inheritance is used in C #, but inheritance carries the chain. What is the best answer?
Here is a snippet of code - I hope it clarifies the problem:
public abstract class Course { public abstract void AddStudent(StudentName sn, int f); public abstract decimal CalculateIncome(); } public abstract class WritingCourse : Course { public void AddStudent(StudentName sn, int f) {
Julesyw
source share