Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
12bitfloat1081737dThat's kinda how OO langs work though
Java doesn't really check that whether the func was overriden or not, it just fetches the function pointer for func doSomething from the vtable and calls that
More sophisticated compilers will do some shenanigans like devirtulization where they can see if only one concrete subclass exists, they will just statically call the method without lookup first -
Lensflare2131437d@12bitfloat vtable triggered some repressed memories from my c++ time.
Now I need vodka to make them disappear again… -
Lensflare2131436d@whimsical I don’t. But I need to maintain the facade because everyone is expecting me to do it because I‘m a dev. -
D-4got10-01280436d -
Lensflare2131434d@whimsical actually that’s a lie. I wear sandals because I don’t give a shit about style 🤣
Related Rants

Coworker's whiteboard today
New lesson learned: In Java, object creation only happens at runtime.
A a = new B();
a.doSomething();
Compiler steps:
- checks if A exists
- checks if B exists
- checks if B is subclass of A
- compiles (code -> Bytecode)
Runtime:
- checks if B overrides doSomething() of A
- executes the overridden version
rant
compiletime
java
runtime