Is member function virtual by default in scala? Is it different than Java in this matter?
When a method is overriden you have to explicitly state that, but there is no “virtual”.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes.
No, in Java methods are also virtual unless they’re explicitly defined as
final.However Java is different from Scala in that Java doesn’t require (or have) the
overridekeyword in order to override methods – it does have an@overrideannotation though (since Java 1.5) and gives a warning when you override a method without that annotation.