PrepAway - Latest Free Exam Questions & Answers

Which code segments should you use? (Each correct answer presents part of the solution

You are creating a class named Consultant that mustinherit from the Employee class. The Consultant class must modify the inherited PayEmployee method.
The Employee class is defined as follows.
<code>
function Employee() {}
Employee.prototype.PayEmployee = function ( ){
alert(‘Hi there!’);
}
</code>
Future instances of Consultant must be created withthe 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.)

PrepAway - Latest Free Exam Questions & Answers

A.
Consultant.PayEmployee = function ()
{
alert(‘Pay Consulant’);
}

B.
Consultant.prototype.PayEmployee = function ()
{
alert(‘Pay Consultant’);
}

C.
function Consultant () {
Employee.call(this);
}
Consultant.prototype = new Employee();
Consultant.prototype.constructor = Consultant;

D.
function Consultant() {
Employee.call(this);
}
Consultant.prototype.constructor = Consultant.create;

2 Comments on “Which code segments should you use? (Each correct answer presents part of the solution


Leave a Reply