Initiating Parent Constructor

Ultimate PHP and MySQL Web Development Object Oriented Programming
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.37
You save:  €34.10
£74.75
List Price:  £104.65
You save:  £29.90
CA$137.57
List Price:  CA$192.60
You save:  CA$55.03
A$149.94
List Price:  A$209.93
You save:  A$59.98
S$129.15
List Price:  S$180.82
You save:  S$51.66
HK$778.49
List Price:  HK$1,089.91
You save:  HK$311.42
CHF 79.53
List Price:  CHF 111.35
You save:  CHF 31.81
NOK kr1,010.83
List Price:  NOK kr1,415.20
You save:  NOK kr404.37
DKK kr636.88
List Price:  DKK kr891.67
You save:  DKK kr254.78
NZ$172.05
List Price:  NZ$240.87
You save:  NZ$68.82
د.إ367.21
List Price:  د.إ514.11
You save:  د.إ146.90
৳12,196.53
List Price:  ৳17,075.63
You save:  ৳4,879.10
₹9,046.19
List Price:  ₹12,665.03
You save:  ₹3,618.84
RM410
List Price:  RM574.02
You save:  RM164.02
₦144,988.49
List Price:  ₦202,989.69
You save:  ₦58,001.20
₨28,070.07
List Price:  ₨39,299.22
You save:  ₨11,229.15
฿3,154.68
List Price:  ฿4,416.68
You save:  ฿1,262
₺4,269.03
List Price:  ₺5,976.82
You save:  ₺1,707.78
B$540.64
List Price:  B$756.92
You save:  B$216.28
R1,686.31
List Price:  R2,360.91
You save:  R674.59
Лв166.76
List Price:  Лв233.47
You save:  Лв66.71
₩147,691.32
List Price:  ₩206,773.76
You save:  ₩59,082.43
₪320.32
List Price:  ₪448.46
You save:  ₪128.14
₱5,904.40
List Price:  ₱8,266.40
You save:  ₱2,362
¥15,590.21
List Price:  ¥21,826.92
You save:  ¥6,236.70
MX$1,803.96
List Price:  MX$2,525.62
You save:  MX$721.65
QR363.74
List Price:  QR509.26
You save:  QR145.51
P1,323.96
List Price:  P1,853.60
You save:  P529.63
KSh12,870.71
List Price:  KSh18,019.51
You save:  KSh5,148.80
E£4,753.26
List Price:  E£6,654.76
You save:  E£1,901.49
ብር15,541.53
List Price:  ብር21,758.76
You save:  ብር6,217.23
Kz91,205.27
List Price:  Kz127,691.03
You save:  Kz36,485.76
CLP$91,415.85
List Price:  CLP$127,985.85
You save:  CLP$36,570
CN¥705.43
List Price:  CN¥987.64
You save:  CN¥282.20
RD$6,391.40
List Price:  RD$8,948.22
You save:  RD$2,556.81
DA12,968.19
List Price:  DA18,155.99
You save:  DA5,187.79
FJ$227.15
List Price:  FJ$318.02
You save:  FJ$90.87
Q764.39
List Price:  Q1,070.17
You save:  Q305.78
GY$20,877.42
List Price:  GY$29,229.22
You save:  GY$8,351.80
ISK kr12,635.73
List Price:  ISK kr17,690.53
You save:  ISK kr5,054.80
DH918.06
List Price:  DH1,285.32
You save:  DH367.26
L1,690.45
List Price:  L2,366.70
You save:  L676.25
ден5,247.73
List Price:  ден7,347.03
You save:  ден2,099.30
MOP$799.94
List Price:  MOP$1,119.96
You save:  MOP$320.01
N$1,690.23
List Price:  N$2,366.39
You save:  N$676.16
C$3,672.42
List Price:  C$5,141.53
You save:  C$1,469.11
रु14,413.93
List Price:  रु20,180.08
You save:  रु5,766.14
S/336.38
List Price:  S/470.94
You save:  S/134.56
K423.47
List Price:  K592.88
You save:  K169.40
SAR375.19
List Price:  SAR525.28
You save:  SAR150.09
ZK2,311.36
List Price:  ZK3,235.99
You save:  ZK924.63
L433.96
List Price:  L607.57
You save:  L173.60
Kč2,066.18
List Price:  Kč2,892.73
You save:  Kč826.55
Ft32,745.77
List Price:  Ft45,845.39
You save:  Ft13,099.61
SEK kr928.55
List Price:  SEK kr1,300.01
You save:  SEK kr371.46
ARS$143,636.25
List Price:  ARS$201,096.50
You save:  ARS$57,460.24
Bs689.66
List Price:  Bs965.55
You save:  Bs275.89
COP$383,944.98
List Price:  COP$537,538.34
You save:  COP$153,593.35
₡48,949.59
List Price:  ₡68,531.39
You save:  ₡19,581.79
L2,627.62
List Price:  L3,678.78
You save:  L1,051.15
₲682,078.43
List Price:  ₲954,937.09
You save:  ₲272,858.66
$U3,924.12
List Price:  $U5,493.92
You save:  $U1,569.80
zł360.22
List Price:  zł504.33
You save:  zł144.10
Already have an account? Log In

Transcript

Hello, in this video, I am going to show you how to initiate your parent constructor. So at the moment I've got this, you know, car class got this BMW class that inherits using the extends keyword from the car class and then create an object of it. For every load that it says this car. This is the starting. And he calls this constructor because there's no constructor in here. If I put a constructor in here, however.

So and I'll just say, child constructor. Watch what happens is the child constructor. So if the child that you created an object or has a constructor that he won't invoke the parent constructor, but there may come a time where you want to invoke that as well but also do some specific functionality within the Classes constructor this child. And to do that, go to your core, the pair One, two, you put the class name coloca. Then you just put, you know the class name a yen, and run it. Oh, okay, you'll be almost on the school.

There we go. So this is the call started. And then yeah, you've got the constructor name like. So you can do that with the constructor inside of it, if it is inheriting if this constructor had wasn't, you know, expecting variables from solar, you know, parameters to be passed in. You could pass them in like so. So it's a great way of having some specific functionality code that's run initially on a child class, but you also can invoke the parents constructor as well, and yet really cool stuff.

So that's it. If you have any questions, feel free to pop me a message. And 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.