You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Delphi did have constructors more similar to Smalltalk than Java. Didn't have a silly special "new" keyword.. it was a method on the class itself.
I see a few people respond with "just use a class-side method", but I think newcomers often miss the distinction and such comments fly by without sticking. It might be good to have an exercise focused specifically on analogies to "constructors" as people understand them in other languages.
Could it be said that the "instance creation" class-side protocol is equivalent to "constructors" ?
Possible reference cases:
Rectangle
Delay
Month
Color
The text was updated successfully, but these errors were encountered:
Could it be said that the "instance creation" class-side protocol is equivalent to "constructors" ?
Short answer I'd say yes. I treat methods in this protocol as a way of getting a fully initialized object in a convenient way. In my own projects I use class side initializing methods as a public interface and the proper way to get an instance of that class instead of using #new and setting up all the instance variables yourself.
Saw this comment from a newcomer on Discord...
I see a few people respond with "just use a class-side method", but I think newcomers often miss the distinction and such comments fly by without sticking. It might be good to have an exercise focused specifically on analogies to "constructors" as people understand them in other languages.
Could it be said that the "instance creation" class-side protocol is equivalent to "constructors" ?
Possible reference cases:
The text was updated successfully, but these errors were encountered: