-1
sealed class MySealedClass {
  data class MyDataClassInsideSealed(): MySealedClass()
}

Wouldn't this cause an infinite loop?

Cloud Town
  • 83
  • 5

1 Answers1

0

No, this does not cause an infinite loop. A sealed class is abstract by itself, it cannot be instantiated directly. Therefore it doesn't really contain itself, in the way you are thinking.

Jeff Padgett
  • 2,380
  • 22
  • 34