Avoiding abstract
Regan Heath
regan at netmail.co.nz
Fri Jun 1 07:19:50 PDT 2007
Something else you might want to look at is how std.socket manages to return a TcpSocket or UdpSocket from it's base class Socket method 'accept'.
The trick/magic is in the accepting() method which the derived class overrides, internally it creates a new derived class (TcpSocket, UdpSocket) returning it as a base class (Socket) reference to the base class 'accept' call which then assigns the internal socket handle and returns it.
You could do something very similar.
Regan Heath
More information about the Digitalmars-d-learn
mailing list