'm working on a C# project where I have an abstract base class Employee with a parameterized constructor Employee(string name). My derived class FullTimeEmployee has a constructor that takes three parameters (string name, double salary, int vacationDays). Inside the FullTimeEmployee constructor, I'm trying to initialize the base class constructor using base(name), but it seems to reference the constructor of the derived class instead of the intended base class constructor. This results in the error message "a constructor declared in a type with parameter list must have 'this' constructor initializer". I've verified that the constructor call is correct and matches the parameter of the base class constructor. What might be causing this issue, and how can I correctly initialize the base class constructor in my derived class?
a constructer declared in a type with parametere list must have 'this' constructor inisializer error
New contributor
-
Welcome to StackOverflow. Please take a tour and see How to Ask. Specifically: instead of describing your code, post it as text in a form of a minimal reproducible example, including the exact error message(s) you get.– wohlstadCommented 25 mins ago
-
Please show a minimal reproducible example.– SweeperCommented 15 mins ago
Add a comment
|