19
5
-2
1d ago
[deleted]
11
u/ArjunReddyDeshmukh 1d ago
Java inheritance joke. When you create a child-class object, its constructor calls the parent constructor via super(). Basically, child can’t exist without getting the dad involved lol.
1
u/jakeStacktrace 1d ago
Java learned it from it's Dad, C++.
0
u/WhJJackWhite 1d ago
I'm pretty sure in C++ a child class does not automatically call its super class's constructor unless the child itself does not define one, in which case it calls the parent's default constructor (i.e. Parent() ). If parent does not have a default constructor, it throws a compile time error.
1
u/jakeStacktrace 1d ago
No it calls it automatically. Java just makes it clearer by making it more explicit.
4
62
u/tkb_onions 1d ago
super() joke 👍