Sure you can — in your own code. But everywhere else inheritance is a virus. Spring, Rails, .NET Core, Django, Pydantic — just to take some random examples are all fundamentally base on inheritance.
Presumably thinking of virtual methods, in the context of C++ ? At least that used to make your code very slightly slower. Might be measurable in a tight loop?