Overriding in which we can define method in child class method whose name and signature same as parent class method.
Child class can have its own implementation.
Properties:
1.Overriding method name and signature should be same as parent method
2.Overriding method should have either same return type or covariant return type
3.Overriding method either same access level or stronger than overriden method.
4.Final method are inherited but it cannot be overriden.
5.Static method can be overriden by only other static methods.
6.Overriding method cannot through broader exception than overriden method.
7.Non-static method cannot be overriden by static method.
8.Overriding method can throw any unchecked exception even if overriden method doesn't throw it.
9..Overriding method need not throw any checked exception even if overriden method throw it.
10.Constructor are inherited so they cannot overriden.
Child class can have its own implementation.
Properties:
1.Overriding method name and signature should be same as parent method
2.Overriding method should have either same return type or covariant return type
3.Overriding method either same access level or stronger than overriden method.
4.Final method are inherited but it cannot be overriden.
5.Static method can be overriden by only other static methods.
6.Overriding method cannot through broader exception than overriden method.
7.Non-static method cannot be overriden by static method.
8.Overriding method can throw any unchecked exception even if overriden method doesn't throw it.
9..Overriding method need not throw any checked exception even if overriden method throw it.
10.Constructor are inherited so they cannot overriden.
Comments
Post a Comment