
212 C++ Programming
else
cout<<"Metal "<<getMetalType()<<" is not pure."<<endl;
}
};
int main()
{
CuboidMetal c[3]={
CuboidMetal ("Silver",10,9.5,2.8,2793,10.5),
CuboidMetal ("Gold",7.1,5.8,9.1,7103,19.3),
CuboidMetal ("Platinum",3.5,2.7,1.8,189,21.4)
};
SphericalMetal s[3]={
SphericalMetal ("Silver",21,407484,10.5),
SphericalMetal ("Gold",42,5991955.2,19.3),
SphericalMetal ("Platinum",63,22423262.4,21.4)
};
for(int i=0;i<3;i++)
c[i].DeterminePurity();
for(int i=0;i<3;i++)
s[i].DeterminePurity();
}
Output
Metal Silver is pure.
Metal Gold is not pure.
Metal Platinum is not pure.
Metal Silver is pure.
Metal Gold is pure.
Metal Platinum is pure.
5.4 Protected ...