I have a superclass A which contains an inset() function, and a subclass B that also contains an insert function. Is there a way to utilize the A's insert() method in B, along with some other statement's added to B's insert() function?
Asked
Active
Viewed 39 times
1
-
You can call the superclass method from the subclass method by using the `super` keyword. See: [Using the Keyword `super`](https://docs.oracle.com/javase/tutorial/java/IandI/super.html) – Jesper Jul 10 '17 at 08:38
-
If you want to enforce it at the superclass level, see the [Template Method Pattern](https://en.wikipedia.org/wiki/Template_method_pattern#Structure). – shmosel Jul 10 '17 at 08:40