To tylko jedna z 2 stron tej notatki. Zaloguj się aby zobaczyć ten dokument.
Zobacz
całą notatkę
Overloaded functions More than one function of the same name, … but different parameters Type of result is irrelevant (may not be used to overload) … because the result may be ignored in the call int f(int, int); int f(int); int f(long); Pointers to overloaded functions - the compiler has to know which one you mean // we assume prototypes from the previous slide int (*p)(long); //OK p=f; void *pf; pf=f; // ERROR! Parameters of overloaded function must differ Type returned is not considered during compilation, it is examined when function is called int f(int, int); int f(int); int f(long); // OK // int f(int); double f(int); ERROR int ff(int); int ff(double); // OK // ff(1L) ERROR! ambiguous // void *p=ff(1) ERROR! type
... zobacz całą notatkę
Komentarze użytkowników (0)