
Inheritance 227
else
cout<<" Mixed Metal Containing Cuboid "<<CuboidMetal::getMetalType()<<" and
spherical "<<SphericalMetal::getMetalType()<<" is not pure."<<endl;
}
};
int main()
{
FivePercentImpureMixedMetal m("Silver",9,9.5,2.8,2793,10.5, "Silver",21,407484,10.5);
m.DeterminePurity();
}
Output
Compilation error
Program 5.9 produces a compilation error as FivePercentImpureMixedMetal derives Mixed-
Metal in private mode. Hence, all protected and public members of its parent classes, i.e.,
SphericalMetal/CuboidMetal are not accessible to FivePercentImpureMixedMetal. Hence,
it is necessary to derive MixedMetal class in protected mode from SphericalMetal ...