r/ProgrammerHumor • • May 16 '21

StackOverflow in a nutshell.

Post image
14.8k Upvotes

675 comments sorted by

View all comments

1.5k

u/reddevilry May 16 '21 edited May 16 '21

Once I asked a question about inheritance in C++. I was confused how to inherit and posted my question with legit code attempts. People in the answers are like you shouldn't inherit from that class. And then in the comments others are saying you can inherit. And here I am sitting watching their arguments. Like guys just tell me how to do it and be done. It isn't a philosophical question.

98

u/[deleted] May 16 '21

Did you ever figure out inheritance?

218

u/[deleted] May 16 '21

has anyone?

55

u/LesserPolymerBeasts May 16 '21

Yep. After reading all the examples, I know that all vehicles have wheels, but cars have a variable number of doors, whereas motorcycles don't have any.

Now, for step two, I just need to find a large automotive manufacturer that's completely brand new to the idea of software, and I'll be able to nail that interview...

20

u/Eji1700 May 17 '21

And cry yourself to sleep in 10 years when they roll out 2 door offroad unicycles.

→ More replies (1)

49

u/A-Disgruntled-Snail May 16 '21

What’s an inheritance?

110

u/Last-Woodpecker May 16 '21

Isn't that thing that someone gets when their parents die?

48

u/[deleted] May 16 '21

If you're clever you can get it when other people's parents die. I think that might just be a combination of robbery and murder though.

0

u/[deleted] May 16 '21

[deleted]

→ More replies (1)

11

u/[deleted] May 16 '21

Other people have parents?

→ More replies (1)

21

u/kidsonfilms May 16 '21

Confirmed, Batman's Parents are Object Oriented Programming

15

u/[deleted] May 16 '21

No, that's a bat costume

→ More replies (1)

43

u/individual_throwaway May 16 '21

I am almost certain that in any given field, there is a subject that nobody really understands.

In physics, it's quantum mechanics. In programming, inheritance might be a hot contender, together with regular expressions.

33

u/bmw417 May 16 '21

Special appearances by P vs NP and the traveling salesman, those guys really know how to bring down a party

0

u/[deleted] May 16 '21

[deleted]

6

u/Tapeside210 May 16 '21

Did you just use the term ‘exponentially’? Let’s have a seat.

20

u/superluminary May 16 '21

It’s a funny joke. But there are some very real difficulties with classical inheritance, the main one being “what is a class”? If a class if an object, then it must necessarily have a class of it’s own, so what’s the class of Class? Logically, the class of Class is Class, so you have a circular inheritance loop at the top of your hierarchy.

Alternately you can say that a class is not an object, it is syntax. This creates a whole other set of problems. Where do you put your static methods? How do you manipulate classes? You need a whole introspection API.

JavaScript sidesteps all these issues with prototypical inheritance, which is way simpler.

9

u/10se1ucgo May 16 '21

One may even call it...a metaclass...

But then what is the class of a metaclass?

→ More replies (1)

8

u/cdreid May 16 '21

This is why i hated C++ when it came out (yes im that old) i came from c, forth, asm etc which were clear logical languages. Then he drops what my young self called "phiilosophical bullshit into the thing i loved. I eventually had to read a book on general OOP to get it. (I got mediocre..not good). Now im older and get why its incredibly useful in large and team encironments. Still be superhappy to point out its flaws. C++ is the one language you just might accidentally create General ai in by programming while stoned. And not have anyone including yourself able to understand what you did later. "Wait is that recursive inheritance between three classes?"

→ More replies (3)

10

u/patenteng May 16 '21

People do understand quantum mechanics. When Feynman said it he meant that QM is not intuitive to us. But guess what? There are a lot of things in classical physics that are not intuitive, e.g. diffraction.

→ More replies (4)
→ More replies (2)
→ More replies (4)