Call Back function
A callback is a callable that is accepted by a class or function and is used to alter the logic in use based on that callback.
Implementation of callback function
Code-
Output-
Explanation-
Two functions fun1 and fun2 are defined 2 pointers ptr1 and ptr2 pointing to the functions fun1 and fun2 resp. are created A callback function parent is declared which takes two parameter that are the pointers to the functions fun1 and fun2 a function call is made to this call back function passing two argument ptr1 and ptr2. This call back functions calls both the functions separately using the pointer pointing to them. The functions fun1 and fun2gets executed when they are called by parent function.
Name | Views | Likes |
---|---|---|
Cstring-strcspn() | 140 | 0 |
Cstring.h-strcmp() | 216 | 0 |
Cstring.h-strcpy() | 153 | 0 |
Cstring.h-strlen() | 178 | 0 |
Cstring.h-strpbrk() | 124 | 0 |
Cstring.h-strrchr() | 107 | 0 |
Ctype.h – toupper() | 115 | 0 |
Ctype.h- tolower() | 124 | 0 |
Ctype.h – isxdigit() | 144 | 0 |
Ctype.h – isupper() | 115 | 0 |
Ctype.h- isspace() | 125 | 0 |
Ctype.h- ispunct() | 123 | 0 |
Ctype.h- isprint() | 104 | 0 |
Ctype.h- islower() | 132 | 0 |
Ctype.h- isdigit() | 129 | 0 |
Ctype.h- iscntrl() | 111 | 0 |
Ctype.h – isblank() | 122 | 0 |
Ctype.h – isalpha() | 129 | 0 |
Ctype.h- isalnum() | 122 | 0 |
INTRODUCTION OF ctype.h LIBRARY | 106 | 0 |
EVENT LISTENER | 129 | 0 |
Using Mixins with Eventdispacher | 103 | 0 |
INTRODUCTION TO MIXINS | 136 | 0 |
Call Back function | 150 | 0 |
Eventpp Library | 287 | 0 |
Comments