In the given code snippet,
Foo
is declared as an object of the
IBaseViewState
interface, while
Empty
is declared as an object of the
IViewState
interface. Since
IBaseViewState
is a supertype of
IViewState
,
Foo
is not directly accessible from
IViewState
.
However, you can access
Foo
by explicitly referencing the
IBaseViewState
interface, like this:
val foo: IBaseViewState<Nothing> = IBaseViewState.Foo
On the other hand,
Empty
is directly accessible from
IViewState
since it's declared within it. So, you can access it like this:
val empty: IViewState<Nothing> = IViewState.Empty
Both
Foo
and
Empty
are declared as objects, which means that they are singleton instances of their respective classes/interfaces. So, you can use them directly without creating a new instance.
Might be it work