Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » Questions about static casting Polymorphic Array Elements, iterator, Ptr and Pte
Re: Questions about static casting Polymorphic Array Elements, iterator, Ptr and Pte [message #38568 is a reply to message #38566] Mon, 24 December 2012 21:39 Go to previous message
navi is currently offline  navi
Messages: 107
Registered: February 2012
Location: Sydney, Australia
Experienced Member
Quote:

... Correct, but virtual methods of that type CAN.

Of course, it is not an universal truth and sometimes casting you suggest is really needed, but quite often you can better handle issues by good design of base class interface, with the right set of virtual methods doing things.

All in all, the whole purpose of such design is to handle all subclasses the same way...


I think I understand now what you meant by "...rest can be taken care about with virtual methods.". I you design your classes well then it is possible to just getaway with casting once. and rest can be done by calling virtual methods that are accessible through base type pointer/reference. Thanks for explaining it to me in that detail! Smile

Regards
Navi
 
Read Message icon5.gif
Read Message
Read Message
Read Message
Read Message
Previous Topic: circular 'uses' chain
Next Topic: Linking error
Goto Forum:
  


Current Time: Sun Aug 24 14:11:17 CEST 2025

Total time taken to generate the page: 0.04613 seconds