Method Overriding

2 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$99.99
List Price:  $139.99
You save:  $40
€85.26
List Price:  €119.36
You save:  €34.10
£73.50
List Price:  £102.91
You save:  £29.40
CA$136.63
List Price:  CA$191.29
You save:  CA$54.65
A$153.90
List Price:  A$215.47
You save:  A$61.56
S$127.88
List Price:  S$179.04
You save:  S$51.15
HK$784.91
List Price:  HK$1,098.91
You save:  HK$313.99
CHF 79.72
List Price:  CHF 111.61
You save:  CHF 31.89
NOK kr1,013.09
List Price:  NOK kr1,418.36
You save:  NOK kr405.27
DKK kr636.08
List Price:  DKK kr890.54
You save:  DKK kr254.45
NZ$166.69
List Price:  NZ$233.38
You save:  NZ$66.68
د.إ367.26
List Price:  د.إ514.18
You save:  د.إ146.92
৳12,273.16
List Price:  ৳17,182.92
You save:  ৳4,909.75
₹8,587.28
List Price:  ₹12,022.54
You save:  ₹3,435.25
RM423.45
List Price:  RM592.85
You save:  RM169.40
₦153,062.69
List Price:  ₦214,293.89
You save:  ₦61,231.20
₨28,403.29
List Price:  ₨39,765.75
You save:  ₨11,362.45
฿3,260.02
List Price:  ฿4,564.16
You save:  ฿1,304.14
₺3,998.39
List Price:  ₺5,597.91
You save:  ₺1,599.51
B$542.04
List Price:  B$758.88
You save:  B$216.84
R1,774.73
List Price:  R2,484.69
You save:  R709.96
Лв166.54
List Price:  Лв233.16
You save:  Лв66.62
₩136,889.26
List Price:  ₩191,650.45
You save:  ₩54,761.18
₪333.71
List Price:  ₪467.20
You save:  ₪133.49
₱5,666.23
List Price:  ₱7,932.95
You save:  ₱2,266.72
¥14,541.63
List Price:  ¥20,358.87
You save:  ¥5,817.23
MX$1,871.77
List Price:  MX$2,620.55
You save:  MX$748.78
QR365.67
List Price:  QR511.95
You save:  QR146.28
P1,325.25
List Price:  P1,855.40
You save:  P530.15
KSh12,918.70
List Price:  KSh18,086.70
You save:  KSh5,168
E£4,967.64
List Price:  E£6,954.89
You save:  E£1,987.25
ብር13,885.93
List Price:  ብር19,440.87
You save:  ብር5,554.93
Kz91,186.38
List Price:  Kz127,664.58
You save:  Kz36,478.20
CLP$93,038.69
List Price:  CLP$130,257.89
You save:  CLP$37,219.20
CN¥717.25
List Price:  CN¥1,004.19
You save:  CN¥286.93
RD$5,988.17
List Price:  RD$8,383.68
You save:  RD$2,395.51
DA12,961.67
List Price:  DA18,146.86
You save:  DA5,185.18
FJ$225
List Price:  FJ$315.01
You save:  FJ$90.01
Q769.28
List Price:  Q1,077.02
You save:  Q307.74
GY$20,931.81
List Price:  GY$29,305.38
You save:  GY$8,373.56
ISK kr12,141.78
List Price:  ISK kr16,998.98
You save:  ISK kr4,857.20
DH898.01
List Price:  DH1,257.26
You save:  DH359.24
L1,669.84
List Price:  L2,337.85
You save:  L668
ден5,246.25
List Price:  ден7,344.96
You save:  ден2,098.71
MOP$808.96
List Price:  MOP$1,132.57
You save:  MOP$323.61
N$1,759.94
List Price:  N$2,463.99
You save:  N$704.04
C$3,681.74
List Price:  C$5,154.59
You save:  C$1,472.84
रु13,662.37
List Price:  रु19,127.86
You save:  रु5,465.49
S/354.77
List Price:  S/496.69
You save:  S/141.92
K413.28
List Price:  K578.61
You save:  K165.32
SAR375
List Price:  SAR525.02
You save:  SAR150.01
ZK2,423.77
List Price:  ZK3,393.37
You save:  ZK969.60
L431.82
List Price:  L604.57
You save:  L172.74
Kč2,098.29
List Price:  Kč2,937.69
You save:  Kč839.40
Ft34,043.57
List Price:  Ft47,662.36
You save:  Ft13,618.79
SEK kr952.20
List Price:  SEK kr1,333.12
You save:  SEK kr380.92
ARS$112,338.76
List Price:  ARS$157,278.76
You save:  ARS$44,940
Bs691.38
List Price:  Bs967.96
You save:  Bs276.58
COP$399,789.51
List Price:  COP$559,721.32
You save:  COP$159,931.80
₡50,528.66
List Price:  ₡70,742.15
You save:  ₡20,213.48
L2,614.10
List Price:  L3,659.85
You save:  L1,045.74
₲797,359.95
List Price:  ₲1,116,335.83
You save:  ₲318,975.88
$U4,013.06
List Price:  $U5,618.44
You save:  $U1,605.38
zł362.08
List Price:  zł506.92
You save:  zł144.84
Already have an account? Log In

Transcript

Hello, in this JavaScript video I am going to show you the before I stop talking, I'm just messing with you. Can you get I'm sure you know it's method overriding the title of the video on the lesson. Okay, so method overriding, as you can see, we did inheritance. If you didn't check the video, I'd highly recommend going and have a look at that. And okay, so we have these three classes they inherit from here. It has a constructor, but you also have this function called vehicle funk.

And an actor I asked you to call the vehicle form of the car object and the boy object and our bike object we did, but the car object as well. Okay, so now that's done. What we're going to do is override the method in class and to override it. All we do is literally take the Exact same structure. But we do something else with method. So we're gonna say console dot log, we are going to first save that refresh, as you can see, when we call it from the car object.

And in the same the call object to possess, you know, a object of the car class, when we call it from the car object said this is the car class, whereas when we call it from the bike object is a dysfunction from the vehicles class. So we've overridden the method and all it all that is, is we are specifying a new structure, a new piece of code to be run in stead. So maybe you have this vehicle class and you have maybe a method for moving and you have a car you have a bike, you have one sort of vehicles can you have a claim though your vehicle as well you have a boat, those four vehicles and maybe Be the boat has a slightly different functionality compared to the call the bike and the plane for moving. And we could override the method without having to write a new separate method, therefore creating redundant code for the other free classes that have the exact same functionality.

So that's method overriding. If you have any questions, feel free to shoot me a message as usual. I look forward to seeing you in the next video.

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.