Programming in HTML5 with JavaScript and CSS3 — Question 60

You are creating a class named Consultant that must inherit from the Employee class. The Consultant class must modify the inherited PayEmployee method. The
Employee class is defined as follows.
function Employee() {}
Employee.prototype.PayEmployee = function ( ){
alert('Hi there!');
}
Future instances of Consultant must be created with the overridden method.
You need to write the code to implement the Consultant class.
Which code segments should you use? (Each correct answer presents part of the solution. Choose two.)

Answer options

Correct answer: B, C

Explanation

Option B correctly overrides the PayEmployee method on the Consultant prototype, ensuring that future instances of Consultant will use this method. Option C is also correct as it establishes the inheritance from Employee and properly sets the constructor for Consultant. Options A and D do not provide the complete and correct implementation needed for the Consultant class to function as required.