Why does Unity have a problem with some voids being private or public?

I just want to know why Unity gets angry at some voids for being private or public. It goes like “Private/Public is not valid for this item”

Oh. I guess that it happens because you can accidentally put voids inside of other voids.