11 Replies
⌛
This post has been reserved for your question.
Hey @lip! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
so i have this 2 constructors right here and Yonetici inherits from the Musteri class
and in Yonetici class it enters super(); section
when it gets into it i want to know what happens
i actually dont want to work if its coming from Yonetici class' super(); section
you could add a check in the super constructor
but practically, constructors shouldn't add the
this
object to other stuff, especially static variables or things like that
i did this there
oh I see
Do you see the
;
at the end of the if
?now i removed the comments and it works but idk if i made a problem

yes
means "call doSomething if something is true"
However, if you add a semicolon like
it's the same as
so it basically runs the doSomething method regardless of the result of the condition
so you mean 'else' will be executed no matter what?
oh I didn't notce the else block
but if you have something you don't want to do for subclasses, you should use a factory method instead of a public constructor