lundi 1 février 2021

OOP is about multple object role?

I have some game_object class which implements i_renderable and i_collideble interfaces:

class some_game_object : public i_renderable,
                         public i_collideble
{
    // some render data
    // some collide data

public:
    virtual void render() override
    {
    }

    virtual void collide( other_class_1* ) override
    {
    }

    virtual void collide( other_calss_2* ) override
    {
    }
};

Am I correct in understanding that we are violating a SRP principle? Or in my case it's all about object role - selfdrawing and behaviour when collides? Is this true OOP solution?

Aucun commentaire:

Enregistrer un commentaire