Skip to content
Advertisement

How to override function/value in a class thats has been extended

A little confused on how to over ride a return value in a function.

Example.

JavaScript

and I have another class that extends the above class. What I am aiming to do is if getFirstName is called from Customer, then itll return a value. If however getFirstName is called from Client, I want it to return null.

JavaScript

How would I go about this?

Advertisement

Answer

just override and return null in client class

JavaScript
Advertisement