Challenge: Factory Pattern
In this challenge, you have to implement the factory pattern to solve the given problem.
We'll cover the following
Problem statement
In this problem, you need to implement a factory ToyFactory
that can create a toy duck
and a toy car
object using either the ToyDuck
or ToyCar
function constructor.
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.