![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum 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 |
| ubuntu to pure debian | Texasone | Linux | 13 | 06-01-2008 09:20 AM |
| Barcode Writer in Pure Postscript 2008-01-19 (Default branch) | iBot | Software Releases - RSS News | 0 | 01-19-2008 05:30 PM |
| Barcode Writer in Pure Postscript 2008-01-01 (Default branch) | iBot | Software Releases - RSS News | 0 | 01-01-2008 01:40 PM |
| Where can i get pure unix? | Bstyle | UNIX for Dummies Questions & Answers | 2 | 12-19-2005 08:13 AM |
| Sharing C++ Objects with virtual function table pointers | Seeker | High Level Programming | 2 | 01-26-2002 11:09 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Pure Virtual Function in C++
Dear All,
Here I want to know why we put =0 in case of pure virtual function, why not =1, =2 or any thing else Please send me answer any one as soon as possible. |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
History.
If I have a function pointer in C typedef int (*foo_ptr)(void); foo_ptr my_foo; I can either (a) leave it to be undefined and a danger to all who touch it (b) set it to point to an implementation of foo() (c) set it to NULL or (foo_ptr)0 so people can check it's validity. C++ is derived from C and setting it to 0 is an indication that this class does not provide an implementation of this function. There are other places where a non-zero initialisation of a pointer is special such as the SIG_IGN/SIG_DFL and _XtInherit. Unless you are either (a) implementing a C++ compiler (b) answering a homework question, the reason why is not actually important. |
|||
| Google The UNIX and Linux Forums |