nus-cs2103-AY2021S2 / forum

10 stars 0 forks source link

Luminus quiz 3 question 4 #367

Open prerthan99 opened 3 years ago

prerthan99 commented 3 years ago

Hi, im just a bit confused as to why we declare the visibility as public (+) given that it was not explicitly mentioned. I understand that if the code does not mention what the visibility is, its safe to assume that it's public hence the answer makes sense following this logical flow. But wouldn't it be safer not to put anything as this matches the code better? thanks in advance :)

Screenshot 2021-04-23 at 11 05 39 PM

totoyoyo commented 3 years ago

If the code does not mention visibility, the default is package-private, so ~. Public would then be incorrect.