Why would you use a template? I don't see the abstraction needed in this case. A true object-oriented design will fit nicely into the features of C++.
The interface exposed by the base to the derived class will allow a certain amount of customization of that class' implementation. The number of versions will depend on how much access you're given to the base and how you can use that to alter the functionality. Usually if you need to use a friend the design is not really an OOD. I try to use design patterns as much as possible. Design patterns work well for me even at the class level. You should also be concerned about how your design will scale into something far more complex. A true OOD will scale nicely for the most part. Maybe I'm missing something in your code listing. If you need to call the protected functions in the base class, delegate the functionality through wrapper functions. You could also just make one member function a friend, but including the friend feature is not a good idea. Best Regards, Jim Smith --- On Mon, 5/25/09, topimaurola <[email protected]> wrote: From: topimaurola <[email protected]> Subject: [c-prog] Re: c++ protected members To: [email protected] Date: Monday, May 25, 2009, 1:53 PM if the class C1 is defined as: template<typename T> class C1: public C0 { ... }; Then there is no way (that I am aware of ) to define all possible versions of C1 as friend of C0. Topi --- In c-p...@yahoogroups. com, Jim Smith <jmclaurin11@ ...> wrote: ... > If you already have a class defined that derives from the class you > need more access to, why would you not allow access to those > protected members and use that class type in the signature of the > method accessing the protected members? [Non-text portions of this message have been removed]
