0

should constructor be defined in public?

same with question!

2nd Aug 2016, 11:32 AM
지경준
지경준 - avatar
2 Antworten
+ 1
They can be declared private or protect for the purpose of preventing access to (certain) constructors. This is useful, if you want to control who is able to create an instance of your class.
2nd Aug 2016, 10:56 PM
Stefan
Stefan - avatar
0
not necessary.only constructor has to be declared in public.but they can also be defined outside the class too.
2nd Aug 2016, 1:52 PM
gowtham