I can't give you an example but I sure can give you the structure
I've written alot of IRC clients, first in mIRC scripts, then using VB, then finally attempting C++..
Firstly you need some basic socket knowledge,
1) Sockets -
IRC runs on TCP/IP, port 6667 usually... Most IRC servers use IDENT clients... therefore when you create a bot you need 2 sockets.
The first is a tcp_connect (host: irc.irc.com, port: 6667)
The second is a tcp_listen (host: localhost, port 22)
You only need the first to start off with, however by accepting IDENT requests, you speed up login time significantly, also certain IRC servers don't allow non-IDENT clients because of flooding.