Skip to content

Commit

Permalink
update: clarify primary constructor definition
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahhaggarty committed Aug 1, 2023
1 parent 75a9d1c commit fed1429
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/topics/classes.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Empty

## Constructors

A class in Kotlin can have a _primary constructor_ and one or more _secondary constructors_. The primary constructor is a
A class in Kotlin has a _primary constructor_ and possibly one or more _secondary constructors_. The primary constructor is a
part of the class header, and it goes after the class name and optional type parameters.

```kotlin
Expand All @@ -29,8 +29,8 @@ If the primary constructor does not have any annotations or visibility modifiers
class Person(firstName: String) { /*...*/ }
```

The primary constructor cannot contain any code. Initialization code can be placed in _initializer blocks_ prefixed with
the `init` keyword.
The primary constructor initializes a class instance and its properties. Initialization code can be placed in _initializer
blocks_ prefixed with the `init` keyword.

During the initialization of an instance, the initializer blocks are executed in the same order as they appear in the
class body, interleaved with the property initializers:
Expand Down

0 comments on commit fed1429

Please sign in to comment.