By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,129 Members | 1,331 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,129 IT Pros & Developers. It's quick & easy.


P: n/a
I have a hierarchy of classes that need to be able to be connected to
each other. It consists of an Abstract Base Class, and a set of
descending classes, A, B, C and D. As connections have properties too
(such as the angle between the objects it connects), it will be
modelled as a separate class Connection. I am still deciding whether I
will make Connection templated over the type of objects it connects -
probably I won't. At any rate, I want each object descending of Base to
accept two connections, one incoming at the start, one outgoing at the
end (Connections are oriented, just like the objects they connect).
Unfortunately, not all combinations are valid. Objects of class A
cannot connect to another object of class A, for instance. How would I
implement this neatly? How would I define the virtual methods in Base
to reflect the demand that all descandants of Base should be able to
accept or make connections? How would the methods in the descending
classes be defined, to only make or accept connections in valid
combinations? Any standard design patterns I should look up for this?
Thanks for any tips.

regards Mark

Jul 25 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.