Is it true only in Inheritance or most of the cases ?
public class MyClass {
public int id;
public MyClass() {
// Some stuff
setI
The constructor constructs the object and you should only call things that you know work in the 'not fully constructed state'. In your example the SetId does nothing other that set a value so it's fine. However if SetId used other state/infothat wasn't ready yet then you could run into an issue.
It's not a commandment - rather it's a 'be wary of what you do'