Multiple Class Inheritance

4 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
€87.01
List Price:  €121.82
You save:  €34.81
£74.79
List Price:  £104.71
You save:  £29.92
CA$138.36
List Price:  CA$193.71
You save:  CA$55.35
A$156.17
List Price:  A$218.65
You save:  A$62.47
S$130.73
List Price:  S$183.03
You save:  S$52.29
HK$775.70
List Price:  HK$1,086.01
You save:  HK$310.31
CHF 81.11
List Price:  CHF 113.56
You save:  CHF 32.44
NOK kr1,034.66
List Price:  NOK kr1,448.56
You save:  NOK kr413.90
DKK kr649.63
List Price:  DKK kr909.51
You save:  DKK kr259.88
NZ$166.51
List Price:  NZ$233.12
You save:  NZ$66.61
د.إ367.26
List Price:  د.إ514.18
You save:  د.إ146.91
৳12,143.18
List Price:  ৳17,000.94
You save:  ৳4,857.76
₹8,517.31
List Price:  ₹11,924.57
You save:  ₹3,407.26
RM438.95
List Price:  RM614.55
You save:  RM175.60
₦160,455.95
List Price:  ₦224,644.75
You save:  ₦64,188.80
₨28,047.19
List Price:  ₨39,267.19
You save:  ₨11,220
฿3,321.64
List Price:  ฿4,650.43
You save:  ฿1,328.79
₺3,825.75
List Price:  ₺5,356.21
You save:  ₺1,530.45
B$580.81
List Price:  B$813.15
You save:  B$232.34
R1,863.68
List Price:  R2,609.22
You save:  R745.54
Лв170.05
List Price:  Лв238.07
You save:  Лв68.02
₩142,434.57
List Price:  ₩199,414.10
You save:  ₩56,979.52
₪371.58
List Price:  ₪520.23
You save:  ₪148.64
₱5,666.88
List Price:  ₱7,933.86
You save:  ₱2,266.97
¥14,044.32
List Price:  ¥19,662.61
You save:  ¥5,618.29
MX$1,964.06
List Price:  MX$2,749.77
You save:  MX$785.70
QR364.06
List Price:  QR509.70
You save:  QR145.64
P1,377.36
List Price:  P1,928.36
You save:  P551
KSh12,968.70
List Price:  KSh18,156.70
You save:  KSh5,188
E£5,105.84
List Price:  E£7,148.38
You save:  E£2,042.54
ብር13,093.69
List Price:  ብር18,331.69
You save:  ብር5,238
Kz91,740.82
List Price:  Kz128,440.82
You save:  Kz36,700
CLP$96,144.23
List Price:  CLP$134,605.76
You save:  CLP$38,461.53
CN¥729.16
List Price:  CN¥1,020.86
You save:  CN¥291.69
RD$5,974.40
List Price:  RD$8,364.40
You save:  RD$2,390
DA13,191.38
List Price:  DA18,468.46
You save:  DA5,277.08
FJ$225
List Price:  FJ$315.01
You save:  FJ$90.01
Q770.11
List Price:  Q1,078.19
You save:  Q308.07
GY$20,971.40
List Price:  GY$29,360.80
You save:  GY$8,389.40
ISK kr12,607.73
List Price:  ISK kr17,651.33
You save:  ISK kr5,043.60
DH923.87
List Price:  DH1,293.46
You save:  DH369.58
L1,727.84
List Price:  L2,419.05
You save:  L691.20
ден5,350.32
List Price:  ден7,490.67
You save:  ден2,140.34
MOP$798.94
List Price:  MOP$1,118.55
You save:  MOP$319.61
N$1,876.81
List Price:  N$2,627.61
You save:  N$750.80
C$3,677.16
List Price:  C$5,148.17
You save:  C$1,471.01
रु13,633.12
List Price:  रु19,086.91
You save:  रु5,453.79
S/370.41
List Price:  S/518.59
You save:  S/148.18
K406.40
List Price:  K568.98
You save:  K162.58
SAR375.06
List Price:  SAR525.10
You save:  SAR150.04
ZK2,847.18
List Price:  ZK3,986.17
You save:  ZK1,138.98
L433.04
List Price:  L606.28
You save:  L173.23
Kč2,180.17
List Price:  Kč3,052.33
You save:  Kč872.15
Ft35,589.07
List Price:  Ft49,826.13
You save:  Ft14,237.05
SEK kr949.26
List Price:  SEK kr1,329.01
You save:  SEK kr379.74
ARS$109,240.97
List Price:  ARS$152,941.73
You save:  ARS$43,700.76
Bs691.72
List Price:  Bs968.44
You save:  Bs276.71
COP$425,733.06
List Price:  COP$596,043.32
You save:  COP$170,310.25
₡50,248.77
List Price:  ₡70,350.29
You save:  ₡20,101.51
L2,584.74
List Price:  L3,618.74
You save:  L1,033.99
₲799,721.01
List Price:  ₲1,119,641.41
You save:  ₲319,920.40
$U4,234.41
List Price:  $U5,928.35
You save:  $U1,693.93
zł372.68
List Price:  zł521.77
You save:  zł149.09
Already have an account? Log In

Transcript

Welcome to the 62nd tutorial on c++ program series and in this part we're gonna be looking at the multiple class inheritance feature. c++ allows a class to inherit from multiple classes in the previous part we looked at inheriting from a single class. c++ allows you to inherit from multiple classes. This is useful as you may have several classes that inherit from all the classes but only need certain properties. multiple inheritance allows you to group the properties essentially, together, inherit those group properties basically allows you to organize your code a little better, and this allows you to be more efficient at work a certain variable method you don't need to no point having them. So we'll create a class called vehicle.

Public speed, just got the hiccup safely Just class extra taught now in here we can do public boo blue doors and now we're going to do is create a new class to cold call and to inherit from more classes you do call on the open for the public. Then you put well both for the classes that you want to inherit from you vehicle info comma, the bulk public again. Well there's gonna be extra parts in this situation or whatever the name of your class ID and then in here, we're simply gonna have it's gonna have a nova variable is broken. Now what we can do is a semicolon there or we can do is create an object of this class of car BMW pm. pm the veto speed equals 200 bmw.is broken April's true BMW dot has to fold down this causes a BMW dot has exhaust.

Last fall into if C out you probably will be able to be the last first and always want to know we get a value of one is true we do have those real value zero folks activist group Should everybody have one cut it is broken and like it is true for b plus b we should get a value of 200. As you can see, even though called the vendor specifically have the variables declared here because it's inherited from these two classes you can inherit from more than two classes or classes inherit from these two classes. It's a okay and we have all it variables and methods so if we were to just create a method I will just create one for the sake of this tutorial on the void print function. This is implemented so void vehicle print function and an STD see out. There we're gonna do h h h h, e, basically STD Line changes to location.

Now if we just do be able to view print function on your neck, we get he printed out because of this inherited his method as well. So that's it for this part of this series. In the next part we'll be looking at virtual methods. If you have any questions feel free to message us or support us on our systems. That colleague email will be in the description. You can comment on this video which is directly messages for YouTube, or the required links.

The source code will also be in the description. And as usual, thanks for watching and I hope you have a great day.

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.