#how to make if statement for an instance

22 messages · Page 1 of 1 (latest)

finite lantern
#

Where do i place the if statement? in the setter or getter

long widgetBOT
#

Hey, @finite lantern!
Please remember to /close this post once your question has been answered!

sacred bay
#

Hm. Typically you don't. Not in a getter nor in a setter

finite lantern
sacred bay
#

My guess is you don't. Why do you want an if?

#

I suppose you could safeguard against negative radius

finite lantern
sacred bay
#

Sorry, I don't see you returning anything that you should modify

#

Okay, with that, then you put it in setRadius

#

And you call setRadius from the constructor

finite lantern
#

do i need static void?

sacred bay
#

void yes, but static needs to go

finite lantern
#

ok

#

thanks

finite lantern
#

d

sacred bay
#

you were talking about a question?

finite lantern
#

never mind

#

i fixed the error