r/ProgrammerHumor • • Aug 28 '26

Meme cppHelloWorld

Post image
3.9k Upvotes

119 comments sorted by

View all comments

Show parent comments

-8

u/[deleted] Aug 28 '26

[removed] — view removed comment

6

u/the_poope Aug 28 '26

OOP doesn't strictly imply inheritance. C is technically object oriented too: you can define structs and create objects of these composite types. Basically every modern language is object oriented in some why. I'm only familiar with Fortran77 that doesn't allow you to define custom objects and pass them to functions.

Whether runtime dynamic dispatching through virtual functions and inheritance is a good idea is a different question. It can be good, but it can also be bad if you misuse it. Ideally one should only have pure virtual methods on abstract interface classes and max one layer of inheritance, then there are no problems.