+ 1
What is the difference between a constructor and void function
3 ответов
+ 13
A void function does not return anything. Or in other words, calling the function will not return you a value. Review return types in the SoloLearn course if this is confusing.
A constructor is a method that's called when an object is instantiated. All classes have a constructor, even if you do not create one manually.
These 2 things are not similar to eachother at all.
+ 1
@Tawanda Yeah, fair enough. I've editted the original post 😜