+ 1

What is the difference between a constructor and void function

22nd May 2017, 3:29 AM
John Makone
John Makone - avatar
3 Answers
+ 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.
22nd May 2017, 3:57 AM
Rrestoring faith
Rrestoring faith - avatar
+ 1
@Tawanda Yeah, fair enough. I've editted the original post 😜
25th May 2017, 2:56 PM
Rrestoring faith
Rrestoring faith - avatar