Apple interview question

C++ polymorphism and overloading. Find connected components from a binary image.