If the boot camp partition of my mac gets a virus, will the macOS part be safe? If the macOS part gets a virus, will the Windows part be affected?
Yes in general - Bootcamp doesn’t lock down the files on either side so you are at risk for data exfiltration / modification / deletion on both sides if either OS is compromised by a competently designed malicious program.
Some virus are simplistic or bug ridden so you might get lucky, but I would protect the Mac side with FileVault if you can’t realistically secure windows. Same on the Mac side - encrypt windows yo be safe.
You could also choose virtualization solution where you could lock things down better with some research and training.
Most viruses (like 99.999% of them) are unable to transfer between operating systems for many different reasons, but theoretically a virus could spread between the two operating systems. What is more likely is that the virus would corrupt the partition table itself.
Take a look at the following links for more info:
- Quora: https://www.quora.com/Can-a-Windows-virus-infect-Mac-OS-X
- MacRumors: https://forums.macrumors.com/threads/can-windows-viruses-acquired-in-os-x-infect-the-boot-camp-partition.1075192/
Please note my percent is not based off of any legitimate statistics, it is exaggerated.