#ELI30 class instance attributes

1 messages · Page 1 of 1 (latest)

woven magnet
#

Hi folks! Can anyone help me understand the difference between: this.direction vs direction when inside a class with eg public Vector3 destination? Is this how you access the specific instance's attribute, and no this references a value shared by the whole class?

zinc sun
woven magnet
#

ok that's what it seems like, but that's kinda...confusing

#

oh, like it has to have a the member attribute? or what?

zinc sun
#

No member variable is the variable declared inside of the class

woven magnet
#

oh, and how do you make class variables?

#

variables constant for the whole class, i mean

zinc sun
#

static or const depending on usage

woven magnet
#

gotcha

#

thanks!!

woven magnet
#

wait but i have noticed sometimes that referencing direction won't work but this.direction does?

woven magnet
#

idk anymore. i changed everything to this. , but i'm switching back lol

woven magnet
#

bc it seemed like things weren't working when i had it the other way

#

idk!