+ 4

In inheritance, must the base class always be "Public"?

1st Jul 2018, 2:59 PM
StEvEn
StEvEn - avatar
9 Answers
+ 3
yes a class can be inherit privately or protected
1st Jul 2018, 3:39 PM
Nikhil Dhama
Nikhil Dhama - avatar
+ 2
nope it's not necessary! assuming you are asking that it is must to inherit the base class publicly.
1st Jul 2018, 3:02 PM
Nikhil Dhama
Nikhil Dhama - avatar
+ 1
hmm therefore the base class can be "Private" or "Protected" when using it as a base class for a derived one?
1st Jul 2018, 3:30 PM
StEvEn
StEvEn - avatar
+ 1
are you asking is base class can be inherit privately and publicly also?
1st Jul 2018, 3:32 PM
Nikhil Dhama
Nikhil Dhama - avatar
+ 1
Yes
3rd Jul 2018, 4:50 AM
RAHUL SALIYA
RAHUL SALIYA - avatar
0
privately and protectively, rather.. yes
1st Jul 2018, 3:34 PM
StEvEn
StEvEn - avatar
0
okay bro. thanks a lot
1st Jul 2018, 3:54 PM
StEvEn
StEvEn - avatar
0
yes
13th Jul 2018, 3:09 PM
deeksha
deeksha - avatar
0
No it can be protected or private also.
13th Jul 2018, 3:16 PM
RAHUL SALIYA
RAHUL SALIYA - avatar