See duplicate codes with the Windows one; consider using template or inheritance?