It's a question that suddenly came to mind while studying.
It seems that when you receive a producer of the super class, you use the distinction as the producer's variables
ex) If the producers of the parent class are Character (String name, intp) and Age (inage) in super(name, hp) and super(age) expressions.
So what if we get producers with different names but all the same variables?
ex)If Player (String name, intp) and Enemy (String name, intp) are in the parent class,
In order to inherit from the lower class, you have to write super(name, hp) and super(name, hp)
Don't you have a compilation error because you can't distinguish it like this?
And I would appreciate it if you could tell me how to inherit producers with different names but the same variable names at the same time.
java super
Java is not provided with multiple inheritance.
Two direct parent classes cannot exist.
Eventually, super calls only one of the overloaded generators of a single direct inheritance class that matches the parameter type.
Java supports only a single inheritance, and compilation errors occur if the method signatures of the constructors are the same. There are many contents that are difficult to understand the explanation or terms of the question, but the situation you asked does not occur in Java.
613 GDB gets version error when attempting to debug with the Presense SDK (IDE)
918 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
573 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
574 Who developed the "avformat-59.dll" that comes with FFmpeg?
© 2024 OneMinuteCode. All rights reserved.