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 | Functions Call-by-Name
- Scala | Methods to Call on a Map | Set-1
- Scala | Methods to Call Option
- Methods to call on a Set in Scala
- Class and Object in Scala
- Inner class in Scala
- Scala | Case Class and Case Object
- Extending a Class in Scala
- Determine the class of a Scala object
- Scala Tutorial – Learn Scala with Step By Step Guide
- Scala String indexOf(String str) method with example
- Scala String contentEquals() method with example
- Scala Int /(x: Int) method with example
- Scala Int /(x: Short) method with example
- Scala Map size() method with example
- Scala SortedMap addString() method with a start, a separator and an end with example
- Scala Iterator addString() method with example
- Scala String substring(int beginIndex, int endIndex) 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.