Join Slack
Powered by
We could just use a data class with one property
# announcements
t
therealbluepandabear
03/04/2021, 12:27 AM
We could just use a data class with one property
n
Nir
03/04/2021, 1:06 AM
I'm no expert, but the basic idea is that this would behave differently in terms of optimization purposes
Nir
03/04/2021, 1:06 AM
a class with one property, is still a class with one property
Nir
03/04/2021, 1:07 AM
if you have a class Foo with a field val bar: Bar
Nir
03/04/2021, 1:07 AM
then, when you have a
foo
, what you have is a pointer to some object
Nir
03/04/2021, 1:07 AM
that object, in turn, has a pointer as well, to yet another object, the actual Bar
Nir
03/04/2021, 1:07 AM
So this trivial "wrapper class" Foo, is turning a single indirection into a double indirection
2
Views
Open in Slack
Previous
Next