In this video, you will learn about extension functions and how they can help you in extending functionalities of a class or an interface you cannot inherit or modify. A concept you will have learned about in previous courses is inheritance. Through inheritance, you can extend or modify certain characteristics and behavior of subclasses in code while reusing functionalities from the parent class wherever needed. Let's say a car company manufactures two different variants of the same car model, one called the base variant and another called the luxury variant, which has premium leather seats, alloy wheels and a professional music system, all offered on top of the base variant. The luxury variant represents Inheritance. In this example, the manufacturer extends the features of the base variant to build a luxury variant. However, there is a common issue with the concept of function inheritance. Let's say you wish to buy the luxury variant, but also add some additional features that the auto company does not provide. If we compare this example with what happens in code, you assume the luxury variant to be a class in this code example, the luxury variant is not possible as the car company is an external entity and would not allow you to directly modify the car during its manufacturing and assembling process, so inheritance is not possible. This is where extension functions come to the rescue. Whenever you need to extend the functionalities of a class or an interface and an external or a third party library that you can not inherit from or modify, you use extension functions. These new functions are called in the same way as any function, just as if they were functions of the original class. Now, let's say the luxury variant has six music speakers, but you wish to add four more music speakers to improve its sound quality. Assuming you would have a class with a variable that stores the number of speakers in a variable, you would then have an extension function that shows the four added speakers. Now this code will print the number of speakers before and after adding the additional four speakers to the luxury car variant. It will initially print six, and then in the second line it will print 10. Now, let's discuss the limitations of extension functions. Extension functions do not allow you to modify the behavior of costs as they are defined for. They only provide an alternate syntax that allows the functions to be called using the dot notation with the type for which the function is defined. For instance, for the class luxury car, a function named getSpeakerCountForLuxuryCar that returns the speaker count and takes in the object of the car as a parameter, can be rewritten as an extension function for the type luxury car as LuxuryCar.getSpeakerCount. Also, you cannot access the private members of a class as these functions are generally defined outside the class. Let's say in the previous example, we add the private visibility modifiers to the variable speaker count and try to run it again. It will result in an error showing that speaker count is private in luxury car. Another limitation of extension functions is that they are resolved statically. Let's look at what that means. Say you have a class called base car that represents the base variant, it is marked with open keywords that allow it to be inherited. Another class, luxury car inherits this class. Both the classes define a function called get speaker count that returns the number of music speakers that the variant has. Now if you define a function, print speaker count with a parameter of parent type base car that prints it's speaker count, and call it using an object of type luxury car, it will print two instead of six. This is because extension functions get invoked on the declared type, which in this case was the parameter of type base car. Moreover, if a class defines a member function with the same name as an extension function, the member function always takes precedence over the extension function. For instance, let's say the class luxury car defines a function that prints the color of the car, and there's an extension function with the same name, when invoked, the function defined in the class is called and the extension function is not executed. Therefore, this prints black as the car's color. In this video, you learned what extension functions are, why you need them, and what their limitations are. Later, you will learn how to define and use extension functions in your code.