Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
5-2-7 reinterpret_cast between derived classes?
#3
Hi,
I don't think that 5-2-3 covers the given situation:
  • 5-2-3 is handling only downcasts whereas my question is about both directions (i.e. casting from a dervied to its base class, too)
  • 5-2-3 is only about polymorphic types, yet not everything which is inherited is necessarily polymorphic: in my example, the classes don't have any virtual functions, or think about private inheritance.
  • 5-2-3 is labeled "advisory", which means that I can assume a project situation where 5-2-3 is not active but 5-2-7 is.

As I have already written: using reinterpret_cast is probably silly since there are better ways to do. But it is possible and someone might actually have a good reason for using it.

The aim of my question is rather general, are derived classes "related" or "unrelated"? Therefore, does rule 5-2-7 apply if you do any pointer conversion (where reinterpret_cast is the most rough one)?
<t></t>
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)