What is override? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is override?

class oop concept

15th Jul 2018, 11:33 AM
Zeeshan Ashraf
Zeeshan Ashraf - avatar
4 Answers
+ 2
Hello, Zeeshan Ashraf ! Override is used when you rewrite (rework, redefine) ALREADY the existing method. For example, in the class Object there is a very popular method toString(), which returns a string representation of the object. https://www.sololearn.com/learn/Java/2165/?ref=app
15th Jul 2018, 11:41 AM
Alexander Sokolov
Alexander Sokolov - avatar
+ 2
overriding having 2methods with the Same method name and parameters and allows a child class to provide a specific implementation of a method that is already provided it's parent class. overloading occurs when 2 or more methods in one class have the same method name but different parameters.
15th Jul 2018, 2:09 PM
Suraj Patil
Suraj Patil - avatar
0
override means create a class A and make a function fun in class A after you make a class B with inherits from class A and then make a function fun in class B again which already present in class A and now function fun is override.this is override.
15th Jul 2018, 12:14 PM
Maninder $ingh
Maninder $ingh - avatar
0
Function overriding is a concepts of polymorphism in oop. In overriding the function with same name and same parameters and same datatypes are in both classes parent and child this is function overriding
19th Jul 2018, 10:39 PM
Kashir
Kashir - avatar