Untitled

 avatar
unknown
plain_text
a year ago
1.2 kB
3
Indexable
#include "shape.h"
#include <iostream>

using namespace std;

class Circle : public Shape {
private:
    int x, y;  // Center of the circle
    int radius;
    int angle;  // Current rotation angle

public:
    Circle(int x, int y, int radius) : x(x), y(y), radius(radius), angle(0) {}

    void Move(int newX, int newY) override {
        x = newX;
        y = newY;
        cout << "Circle moved to (" << x << ", " << y << ")" << endl;
    }

    void MoveX(int newX) override {
        x = newX;
        cout << "Circle moved to x = " << x << endl;
    }

    void MoveY(int newY) override {
        y = newY;
        cout << "Circle moved to y = " << y << endl;
    }

    void Rotate(int newAngle) override {
        angle = newAngle;
        cout << "Circle rotated to angle " << angle << endl;
    }

    void Rotate3D(int newX, int newY, int newZ) override {
        // Since it's a 2D circle, we might not do anything for 3D rotation.
        cout << "Circle rotated to 3D angle (" << newX << ", " << newY << ", " << newZ << ")" << endl;
    }
};

int main() {
    Circle circle(0, 0, 10);
    circle.Move(5, 5);
    circle.MoveX(10);
    circle.MoveY(15);
    circle.Rotate(45);
    circle.Rotate3D(30, 45, 60);

    return 0;
}
Editor is loading...
Leave a Comment