Bad Touching

In writing an extension for our cat, Ada, I've created a class which inherits privately from std::map. In other words, internally, to itself, it looks like a map object, while to everything else, it looks like some other kind of thing. The design is beautiful. It's simple.

However, it won't compile. Some client code is trying to access the class is if it were a map. I hold my nose and expose that part of the map interface.

But it still won't compile. Now different client code wants some other part of the map interface.

I enter using map::this; and using map:that;, but it never successfully compiles until I've exposed the entire map interface.

The beautiful, simple class design is now violated and hideous. I'm totally helpless to do anything about it; it's the only way it will run.

Fri, 19 Jan 2007 07:39

Comments: