Based on the comp.lang.c++.FAQ
Lexemes
Annotated Ref Manual C1990 Page 7
switch(i)
{
case 2: i=3; break;
case 3: i=2; break;
}
v->f(whatever)will call the version of f defined in D (if any) rather than B. In short this use of virtual indicates dynamic dispatching.
type f1(void);The compiler will not permit you to give f 1 any arguments. However
type f2();lets you put in any arguments you like....even if the result is rubbish.
Note. In C++, the above use of void is obsolete
type f2();indicates that no arguments are allowed and
type f2(...);that no checking takes place at all. Note:
type f3(arg1, arg2, ...);expects 2 or more arguments.
In ANSI C void* also appears and means something quite different to
plain void. Plain void indicates the absence of data. void* indicates
the address of some data of unknown type. It is only used for formal
arguments of functions. This functions can be written to use any type of
data. An example is qsort in the standard C library. But a void*
points at objects of unknown size, so pointer arithmetic is not defined on
them. So void* arguments can not have subscripts and the * operator is
undefined on them! Instead the size of the data is put in a different
argument and, internally, the void* pointer is cast into a char* and
all access to the objects is done using the explicit size and memory copy
functions.
Note. In C++ the use of 'void*' for addresses of objects of an unknown type is still legal. It is nearly always better to use polymorphism or templates instead. Templates let the compiler generate the right code to handle the particular data that is being processed. Polymorphism (inheritance+virtual functions) delays the choice of operation until the function is called.
Type name(arguments) constthen it will not change the state of the object and can be safely applied to const arguments and variables of the type.
. . . . . . . . . ( end of section C++ Glossary) <<Contents | End>>