This example shows how Kotlin's companion object can hold a factory method to create instances of a class. The class Animal has a private constructor, so it cannot be created directly. Instead, the companion object has a create() method that takes a type string. It uses a when expression to decide which Animal to create: dog, cat, or unknown. When we call Animal.create("dog"), the factory method runs, matches the "dog" case, creates an Animal with type "dog", and returns it. The variable pet then holds this instance. This pattern helps control how objects are made and keeps creation logic in one place.