Beispiel #1
0
void main() {
Circle cir1(7, 9, 15);
cout<<"cir1 has id = "<<cir1.getId()<<", area = "<<cir1.getArea()<<endl;

Rectangle rect1(-50,70,150,180);
cout<<"rect1 has id = "<<rect1.getId()<<", area = "<<rect1.getArea()<<endl;

Shape * shape1 = &cir1;
cout<<"shape1 has id = "<<shape1->getId()<<", area = "<<shape1->getArea()<<endl;

shape1 = &rect1;
cout<<"shape1 has id = "<<shape1->getId()<<", area = "<<shape1->getArea()<<endl;
}
Beispiel #2
0
int main() {
    cir0();
    cir1();
    return 0;
}