Rohan Maity
10/10/2023, 12:37 PMStylianos Gakis
10/10/2023, 12:56 PMabstract class
vs an interface
Rohan Maity
10/10/2023, 12:57 PMKlitos Kyriacou
10/10/2023, 1:29 PMCLOVIS
10/10/2023, 1:40 PMsealed interface
and sealed class
is the same as between interface
and abstract class
. For example, a class can implement multiple sealed interface
but only a single sealed class
. Etc.Rohan Maity
10/10/2023, 1:41 PMCLOVIS
10/10/2023, 1:43 PMsealed
just means that it cannot be implemented outside the current module. This allows the compiler to know for sure the entire list of implementations, so you don't have to add the else
in a when
. Other than that, sealed interface
are normal interfaces, and sealed class
are normal abstract class
.Rohan Maity
10/10/2023, 1:44 PM