class Phone { public: virtual void ring() = 0; virtual bool ispickedup() = 0; virtual void call() { int counter = 0; while (!ispickedup() && counter < 5) { ring(); ++counter; } } };