![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Help - Cast converts default int return type | rtgreen | High Level Programming | 5 | 04-24-2007 10:15 AM |
| Dynamic SQl in KSH | kousikan | Shell Programming and Scripting | 2 | 03-18-2007 08:12 AM |
| how to dynamic DNS | bondoq | Linux | 1 | 11-14-2006 06:34 AM |
| Dynamic DNS | [MA]Flying_Meat | OS X (Apple) | 0 | 12-06-2005 05:07 PM |
| dynamic pid? | yls177 | UNIX for Dummies Questions & Answers | 2 | 12-17-2002 04:26 PM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
why to use dynamic cast in c++
class base
{ public: virtual void disp() {cout<<"from base\n";} }; class derv : public base { public: void disp() {cout<<"from der\n";} }; int main() { base *b=new derv; b->disp(); derv *d; d=dynamic_cast<derv*>(b); d->disp(); return(0); } ///using dynamic cast the derived type pointer can point base type pointer..why it is necessary...where we should suppose to use this///// int main() { int i; int j; char *a="hi friend how are you"; i=reinterpret_cast<int>(a); j=(int)a; cout<<i<<endl; cout<<j<<endl; return(0); } both will give the same output..then what is the difference b/w reinterpret and ordinary c style cast.....in static_cast also same thing we use c style instead of static_cast.... Last edited by sarwan; 09-01-2005 at 02:48 AM. |
|||
| Google UNIX.COM |
| Forum Sponsor | ||
|
|