Skip to content

Commit 0e4667f

Browse files
committed
Section 13 Abstract Classes
Signed-off-by: https://github.com/Someshdiwan <[email protected]>
1 parent 7557761 commit 0e4667f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Section13AbstractClasses/src/AbstractIMP.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ while interfaces focus on defining a contract for implementing classes.
7070
When overriding an abstract method in a subclass, you can use the same access modifier as the abstract method or a less
7171
restrictive one.
7272

73-
This follows the general rule for method overriding in Java. For example, if an abstract method is declared as protected,
74-
the overriding method in the subclass can be declared as protected or public, but not private.
73+
This follows the general rule for method overriding in Java. For example, if an abstract method is declared as
74+
protected, the overriding method in the subclass can be declared as protected or public, but not private.
7575

7676
This allows for greater flexibility in the subclass while maintaining the contract defined by the abstract class.
7777

@@ -84,7 +84,8 @@ abstract class Parent {
8484

8585
class Child extends Parent {
8686
@Override
87-
public void method() { // Less restrictive, so it's allowed
87+
public void method() {
88+
// Less restrictive, so it's allowed
8889
// implementation
8990
}
9091
}

0 commit comments

Comments
 (0)