
282 C++ Programming
cout<<"CuboidMetal Destructor Called"<<endl;
}
};
int main()
{
CuboidMetal c1("Silver",10,9.5,2.8,2793,10.5);
CuboidMetal c2("Gold",7.1,5.8,9.1,7103,19.3);
CuboidMetal c3("Platinum",10,9.5,2.8,5400,21.4);
MetalShape* m[ 3 ]={ &c1,&c2,&c3};
for(int i=0;i<3;i++)
m[i]
-
>DisplayData();
}
Output
Metaltype:Silver
Length10
Breadth9.5
Height2.8
Mass:2793
Accurate_Density:10.5
Metaltype:Gold
Length7.1
Breadth5.8
Height9.1
Mass:7103
Accurate_Density:19.3
Metaltype:Platinum
Length10
Breadth9.5
Height2.8
Mass:5400
Accurate_Density:21.4
CuboidMetal Destructor Called
MetalShape Destructor Called
CuboidMetal Destructor Called
MetalShape Destructor Called
CuboidMetal ...