"Daniel T." <danie...@earthlink.net> wrote:
"Angus" <nos...@gmail.com> wrote:
My thinking is I would need to use some sort of polymorphic
interface class. Is this idea along the right lines:
Probably not. I would only do the above is I had to change
hardware at runtime and I have a feeling that isn't the case.
The original poster didn't specify what his program was doing, but
polymorphic interfaces were certainly an important part of the
telephone systems I worked on. First, because you normally connect
more than one piece of equipment to the system, the various
equipment will be of different types, and you want to handle them
identically. And secondly, you're not allowed to shut the system
down, even when upgrading equipment. (The hardware is specially
designed so that you can safely remove a PCB and insert another
without removing power, or even stopping operations on other PCB's
on the same bus. Don't try that on your PC, however.)
That is a different problem than what I was trying to solve. If the OP
One option that I consider better is a variation of the
handle-body or pimpl idiom.
*IF* you just have one type per instance of the program, why
bother. Just define one header file, as many source files (or
libraries) as needed, and link in the appropriate one.