They aren’t. IP Addresses are divided into four parts called octets (192.168.0.1 as an example). Each number between the periods is an octet. These numbers are just a human readable version, the IP address and subnet are actually binary numbers. They are broken into the octets as each 8 bit character is an octet.
by the way there are class A,B,C,D class of ips