Pergunta de entrevista da empresa KAYAK

Create a list of duck objects: each duck has a different quacking behavior and flying behavior. Write your code on the whiteboard.

Resposta da entrevista

Sigiloso

9 de mai. de 2016

I implemented a Duck class and two interfaces for the quacking behavior (with a quack() method) and the flying behavior (with a fly() method). The constructor of the Duck class receives a quacking behavior object and a flying behavior object (each one of the relevant interface) and stores them.