What is th syntax of multiple inheritance? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is th syntax of multiple inheritance?

syntax

22nd Jun 2017, 3:58 PM
Karan Panwar
Karan Panwar - avatar
4 Answers
+ 5
just like single imheritance, you only need to add commas and write class names class A : public B, protected C
22nd Jun 2017, 4:11 PM
Eligijus Silkartas
Eligijus Silkartas - avatar
0
give upvote to question and help me to unlock my badge please.
22nd Jun 2017, 4:13 PM
Karan Panwar
Karan Panwar - avatar
0
thank you
22nd Jun 2017, 4:16 PM
Karan Panwar
Karan Panwar - avatar
0
The general syntax will be like this, class "classname1" : [access specifier] "classname2" , [access specifier] "classname3" Here classname1 is the child class who wants to inherit and classname2 and 3 are parent classes who are being inherited. And access specifier can be public, protected or private. Note: ignore the quotes and square brackets in the syntax.
22nd Jun 2017, 6:04 PM
Apurv Khare
Apurv Khare - avatar