Linked Questions

50 votes
2 answers
183k views

I am confused about the meaning of access modifiers with respect to inheritance. What is the difference between inheritance involving the private, protected and public keywords?
Sista's user avatar
  • 887
16 votes
1 answer
9k views

Possible Duplicate: What are access specifiers? Should I inherit with private, protected or public? Difference between private, public and protected inheritance in C++ To all you cpp experts, In ...
gdlamp's user avatar
  • 617
9 votes
5 answers
4k views

Possible Duplicate: Difference between private, public and protected inheritance in C++ What is difference between deriving as protected or private in c++? i am not able to figure out, since both ...
paseena's user avatar
  • 4,345
0 votes
1 answer
4k views

I am having a hard time trying to understand why the variable engineNum is inaccessible from within the function in the class Pickup. My basic understanding is, if the class is inherited the private ...
Switchkick's user avatar
  • 2,836
8 votes
2 answers
184 views

Why would the following code run into error of ‘A’ is an inaccessible base of ‘B’? Here's my thoughts: whenever we call function foo(), it will execute new B(5), which will first call the constructor ...
Jeremy's user avatar
  • 409
0 votes
3 answers
2k views

I was looking up some unknown book about C++. and faced with this table which title reads. " ― As the result of inheritance all fields of base class are being inherited by derived class." ...
git_blame_me's user avatar
2 votes
1 answer
742 views

Simple code: class A { private: int a; protected: int b; public: int c; }; class B : protected A { }; class C : protected B { }; I know in Class B, a will remain private & b and c are ...
Locked Rooms's user avatar
-1 votes
1 answer
605 views

Possible Duplicate: Difference between private, public and protected inheritance in C++ One of the examples in my lecture notes is class TransportShip : public GameUnit { int capacity; ...
i love stackoverflow's user avatar
0 votes
2 answers
218 views

I'm trying to inherit some private members of a class. I'm not going to put any of the other cpp files or .h files because this should only concern BoxClass.h, Bullet.h, and Bullet.cpp. In bullet.cpp ...
Zack Oliver's user avatar
-3 votes
1 answer
402 views

In the following code, if the base class is derived as protected then the code doesn't work. Why? When exactly are protected and private access specifiers used when inheriting base class having ...
Sahil Dhawan's user avatar
-1 votes
1 answer
243 views

I was reviewing inheritance and I saw the three rules of casting based on the following code. (from https://www.youtube.com/watch?v=EYuPBkgJtCQ) class B{}; class D_priv: private B{}; class D_prot: ...
Lusha Li's user avatar
  • 329
-3 votes
1 answer
183 views

I created a linked list in c++. First I created a class Node then another class called List. My program runs perfectly. The thing is, I don't understand why there is no inheritance between Node and ...
Abdul Wahab's user avatar
0 votes
2 answers
108 views

My questions is why b.getmultiply(); will not cause compilation error? Class B is private inherit from class A, and x and y are members of class A. class A { public: int x; int y; ...
jmmom's user avatar
  • 313
1 vote
1 answer
159 views

I came across this question while experimenting with following simple code. #include <iostream> using namespace std; class A{ public: A(){ cout << "Def contr A" << ...
e11438's user avatar
  • 904
-5 votes
6 answers
252 views

what is the difference between public members and publicly inherited protected members? (as it is said that protected members can only be accessed by the base class and immediate next derived class. ...
user2273629's user avatar

15 30 50 per page
1
2 3 4 5
8