This concept is used when we want to call super class method. So whenever a base and subclass have same named methods then to resolve ambiguity we use super keyword to call base class method. The keyword “super” came into this with the concept of Inheritance.
Below is the example of call a method on a superclass.
I'm reading I'm writing
In above example, we are calling multiple method of super class by using super keyword.
This is student class This is person class
In the above example, we have seen that if we only call method
message() then, the current class
message() is invoked but with the use of super keyword,
message() of super class could also be invoked.
- Calling A Super Class Constructor in Scala
- Scala | Methods to Call on a Map | Set-1
- Scala | Functions Call-by-Name
- Scala | Methods to Call Option
- Inner class in Scala
- Class and Object in Scala
- Extending a Class in Scala
- Determine the class of a Scala object
- Scala | Case Class and Case Object
- Scala Int *(x: Int) method with example
- Scala Map last() method with example
- Scala map contains() method with example
- Scala Int >>>(x: Int) method with example
- Scala Int !=(x: Int) method with example
- Scala Set &~() method with example
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.