jeudi 11 mai 2023

How to remove Tight coupling from the below code [closed]

How can I remove the tight coupling between Foo and Boo classes?

class Boo;

class Foo {
private:
        Boo *x;
    public:
        static void Print(Boo *b) { cout << "Some Solution " << endl; } 
};

class Boo {
    public:
        void Print() {Foo::Print(this); }
};


int main ()
{
    Boo *b = new Boo;
    b->Print();
    return 0;
}

How can I remove the tight coupling between Foo and Boo classes?

Aucun commentaire:

Enregistrer un commentaire