163. Abstraction

Question.1

A WiFi module hides complex internals behind a simple API:

class WiFiModule {
private:
   void spi_write(uint8_t b) { /* ... */ }
   void handshake_tcp() { /* ... */ }
   int socket_id;
public:
   void connect(const char* ssid, const char* pass) {
       spi_write(0x01);
       handshake_tcp();
   }
};

WiFiModule wifi;
wifi.connect("HomeNet", "1234");

What does abstraction achieve here?

Need Help? Refer to the Quick Guide below

Select Answer