> In this interview, C++ creator Bjarne Stroustrup suggests
> C++ programmers can get the most from C++ by avoiding the
> perils of staying too low level and venturing too
> object-oriented in C++ programming style.
>
>
http://www.artima.com/intv/goldilocks.html>
> What do you think of Bjarne's comments?
My question pertains to Object Oriented style in C++.
I would like to ask Bjarne if an object - oriented resolve
can be made correctly given change factors of his Date example. I include the Bjarnes comments from page 4 bottom paragraph for ease of reference to the problem domain.
Bjarne's comments Start
I've seen the Date problem solved by having a base class Date with some operations on it and the data protected, with utility functions provided by deriving a new class and adding the utility functions. You get really messy systems like that, and there's no reason for having the utility functions in derived classes. You want the utility functions to the side so you can combine them freely. How else do I get your utility functions and my utility functions also? The utility functions you wrote are independent from the ones I wrote, and so they should be independent in the code. If I derive from class Date, and you derive from class Date, a third person won't be able to easily use both of our utility functions, because we have built dependencies in that didn't need to be there.
Bjarne's comments finish.
Viewpoint change considerations:
Question is : I wonder if you might evaluate the following consideration of outside function groupings for class use with inheritance or derived class formatting please.
Date Class:
Date class purpose : To evaluate/display current date of any TimeZone
I Used the Invariant factor to create date class thus clearly defined.
Exact change to consider for class correctness:
If I have 60 functions which can be segregated to 6 groups. Each are premised in context as clearly defined. Is it ok to use these functions to create a class for the purpose of deriving a class with the Date class.
The stipulation is that the 6 groups are clearly defined.
Using the functions as classes derived from groups
// group example is : finding times given ships compass
// group example is : finding times given star positions
// group example is : finding times given sun locations
// extend hypothetical examples to 6 groups 10 functions each.
// Windows application use
Instance the derived classes as required through code in events or text based code processing .
Is there anything wrong with doing this given resources are not a problem.
Thankyou
Viewpoint