20a-InheritAccess

20a-InheritAccess - } }; int main (void) { A a; a.Go();...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
#include <iostream> using namespace std; class A { protected: int y; public: A() { y = 10; } void Go() { cout << "Go";} }; class B : A { /* Inherited parts: private: int y; A() { y = 10; }*/ public: B() { cout << y << endl; } }; class C : B { C() { //cout << y << endl; // cannot access if B : private A
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: } }; int main (void) { A a; a.Go(); //a.y; B b; //b.Go(); // cannot access if B : protected A or B : private A return 0; } /* Go10 Press any key to continue . . . */...
View Full Document

This note was uploaded on 10/05/2011 for the course CS 37 taught by Professor Glenncuevas during the Summer '09 term at Irvine Valley College.

Ask a homework question - tutors are online