Since there is no inheritance type specified, the default is private. Therefore your public and protected members become private and your private members are not accessible to your derived class. Your protected variable from A is then becoming private in B, which is then not accessible from C.
I think the solution is to use public inheritance:
Class B: public A
Class C: public B
Edited 6 Years Ago by jonsca: base <->derived
C++ has 3 levels of inheritance (private, protected, and public). Although they are partially-related, these do not have the same meaning as the internal access levels within a class. Think of this version as meaning "the members of the base class will be shifted so that the public members will have the access level (inheritance level) in the derived class".
The 'public' inheritance level is the one you want for "true" inheritance. This level keeps the access levels of the base class' members the same as in the base class.
Using protected or private inheritance is more restrictive and less like "true" inheritance.
OK, so HostGator for some reason no longer allows gcc/g++ access unless you have a Designated Server account, which is a lot of money to spend just to compile my "Hello World" program. Thus I figured I'd compile at home, then upload. Program is your regular old bare-bones Hello World ...
Hi. I have a form with list box : lst_product, datagridview : grd_order and button: btn_addline. lst_product has a list of product ids selected from database (MS Acess 2013) , grd_order is by default empty except for 2 headers and btn_addline adds rows to grd_order.
Hi, as I was told that my code doesn’t scale well at all, I thought perhaps I’d try to get a better understanding of interfaces/abstract classes and classes and the relationship between them.
I don’t want at this stage work on a big separate project as I've already got plenty ...