May 2012
Intermediate to advanced
679 pages
16h 56m
English
Earlier, we had compile time error with private derivation. We can modify that Program 9.2 (private2.cpp), therefore, it works fine. Well, this is only working indirectly. We do not recommend this as a standard programming practice.
Problem: Rewrite Program 9.2 such that we could access private members of the base class.
Solution: See Program 9.5.
// private3.cpp#include<IOSTREAM.H>#include<string.h>class Time0{ private: int min; int sec; public : int hr; void setTime(int h ,int m , int s); void show();} ;class Clock : private Time0{ private: char strg[5]; // for AM PMpublic : void defineTime(int h1, int m1, int s1); void ...
Read now
Unlock full access