Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible resolution of KT-58964 (Consider moving content of section 5.1.2 (Sealed classes and interfaces) under section 4.1 (Declarations > Classifier declaration)) #134

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions docs/src/md/kotlin.core/declarations.md
Original file line number Diff line number Diff line change
Expand Up @@ -386,12 +386,14 @@ Due to the [initialization order of a classifier object][Classifier initializati
> // but d1 methods are still delegated to x1
> ```

##### Abstract classes {#abstract-classes-declarations}

A [class declaration][Class declaration] can be marked `abstract`.
Such classes *cannot* be instantiated directly; they are used as superclasses for other classes or objects.
##### Class inheritance modifiers

Abstract classes may contain one or more abstract members: members without implementation, which should be implemented in a subtype of this abstract class.
Class inheritance behaviour can be changed using modifiers, such as `open`, [`abstract`][Abstract classes] and [`sealed`][Sealed classes and interfaces].

- Modifier `open` allows for a class to be inherited from. By default classes are [closed][Classifier type inheritance] (that is, they cannot be inherited from), one should add this modifier to change the behaviour.
- Modifier [`abstract`][Abstract classes] allows for a class to have members without implementation (that is, *abstract members*). Such classes *cannot* be instantiated directly; they are used as superclasses for other classes or objects. Abstract members should be implemented in a subtype of this abstract class.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Modifier [`abstract`][Abstract classes] allows for a class to have members without implementation (that is, *abstract members*). Such classes *cannot* be instantiated directly; they are used as superclasses for other classes or objects. Abstract members should be implemented in a subtype of this abstract class.
- Modifier [`abstract`][Abstract classes] allows for a class to have members without implementation (that is, *abstract members*). Such classes *cannot* be instantiated directly; they are used as superclasses for other classes or objects. Abstract members must be implemented in a non-abstract subtype of this abstract class.

- Modifier [`sealed`][Sealed classes and interfaces] works similarly to the `abstract`, but for *sealed* classes inheritance is limited to the module it was defined in.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Modifier [`sealed`][Sealed classes and interfaces] works similarly to the `abstract`, but for *sealed* classes inheritance is limited to the module it was defined in.
- Modifier [`sealed`][Sealed classes and interfaces] works similarly to the `abstract` modifier, but for *sealed* classes inheritance is limited to the module it was defined in.


#### Data class declaration

Expand Down
Loading