|
-
September 24th, 2002, 06:54 AM
#1
Multiple Inheritence in generated code
I have the following problem when I use Rational Rose.
The Original Problem: I draw the diagram and get Rose to generate the code. I then modify the generated code to add the implementation. This is quite hairy as Rose puts in tons of comment to help its preprocessor draw the diagrams and it is difficult to see the wood for the trees. Further down the line, I have to make modifications to the diagram. If I generate the new code, it wipes out my original implementation.
My Half Solution: Instead of modifying the generated code, I derive from it in an implementation class. I don't need to modify the generated code and all looks well. I can keep on modifying the diagrams and just add to the implementation classes. In a character drawing of UML, it looks like
Code:
GenBase <----- ImplBase
^
|
GenDerived1<-- ImplDerived1
^
|
GenDerived2<-- ImplDerived2
The problem is that, if I wish to call a method from a base class, I can only call the ones in GenXXX: not ImplXXX but really, what I would like to call the ones in ImplXXX, so I now end up with
Code:
GenBase <----- ImplBase
^ ^
| |
GenDerived1<-- ImplDerived1
^ ^
| |
GenDerived2<-- ImplDerived2
This is a multiple inheritence tree where almost every call needs a class qualifier in front of it. I thought of using smart pointer where the implementation somehow pulls in the derived class but I'd have to use some sort of macro to map between the generated class and the implementation class. Obviously, my half solution is wrong. Is there a better way of doing this?
Succinct is verbose for terse
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|