Question
Write a program to create a class called Staff that inherits the following class. The new class overrides the getter function to print that the
Write a program to create a class called Staff that inherits the following class. The new class overrides the getter function to print that the user is a staff member with the showUser() getter method. As example, if the user is John Doe, it prints John Doe is a staff member Make an object from the Staff class and call the getter function of the Staff class to print the above message. 0 point if not using inheritance.
class User{ constructor(firstName, lastName){ this.firstName = firstName; this.lastName = lastName; } //Adding a method. get showUser(){ return `${this.firstName} ${this.lastName} is a user`; } }
show its output as well
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started