ESP8266 working as station while in AP mode
WiFi.begin() is a function of the ESP8266WiFiSTAClass. It changes the WiFi mode for you to STA or AP+STA based on the current mode.

begin functions are in ESP8266WiFiSTA

enableSTA function is in class ESP8266WiFiGeneric