City of Binghamton, New York

Does an swimmng pool, of any type, have to be enclosed by a fence?

Code standards for a swimming pool in a residential occupancy are not the same as the requirements in a commercial occupancy, including public pools.
SWIMMING POOL. Any structure, basin, chamber or tank which is intended for swimming, diving, recreational bathing or wading and which contains, is designed to contain, or is capable of containing water more than 24 inches (610 mm) deep at any point. This includes in-ground, above-ground and on-ground pools; indoor pools; hot tubs; spas; and fixed-in-place wading pools.
In a residential occupancy, a protective barrier is required for a swimming pool, as defined above. Reference the most current version of the NY State Residential Code, Appendix G, for detailed information about the design and installation requirements for swimming pools.

Building Construction