当前位置:网站首页>What is a callback function? Understanding of the word "back"
What is a callback function? Understanding of the word "back"
2022-07-26 12:20:00 【Learning addiction】
Callback function
There are many explanations on the Internet , But the “ return ” Interpreted as “ come back ”, It's hard to understand , in my opinion ,“ return ” Understood as a “ In turn, ” Better , It means the call of role exchange .
Let's explain it :
The program is divided into Applications and Library function
When developing applications, we often call library functions , At this time, if the parameters of the library function require you to pass in a function defined by yourself , The library function will call the function you wrote later , And this process is made up of
You call library functions Turned into The library function calls the function you write , in my opinion , This role exchange is called “ Callback function ” What's the essence of .
Look at it from another Angle , The application belongs to the high level , Library functions belong to the bottom , Generally speaking , yes High level call low level , Now the reverse is Low level calls high level , This transformation of hierarchical roles also reflects “ return ” The meaning of the word calling in reverse
( This is a network diagram , Cut a random one , The source is unknown , It can help understand the calling process )

significance :
Understand the essence of callback function , His significance is obvious , That is to embed your own code into the underlying function ( Or library functions ) in , Because the underlying function ( Or library functions ) It is encapsulated before application development , Some functions need to vary from person to person , What shall I do? ? So only the interface can be preserved , Pass the user-defined function in the form of parameters , Library functions call custom functions in turn , The callback function is just the embodiment of this form .
ps: I've heard of hook functions before (hook), I don't quite understand , It may also achieve a similar effect .
边栏推荐
- Oracle AWR report script: SQL ordered by elapsed time
- [MySQL constraint]
- Can the Windows version of Oracle be used in Linux?
- flink 写redis 比较慢,大家有啥思路优化吗?
- 海外APP推送(下篇):海外厂商通道集成指南
- Pytest interface automation test framework | setup and teardown functions of pytest
- C语言文件知识点
- 干货|语义网、Web3.0、Web3、元宇宙这些概念还傻傻分不清楚?(中)
- V00 - 年纪大了,想做啥就做啥吧
- Pytest interface automated testing framework | pytest obtains execution data, and pytest disables plug-ins
猜你喜欢

JSJ-3/AC220V时间继电器

Use the jsonobject object in fastjason to simplify post request parameter passing

How much do you know about the two infrastructures of the badminton stadium?

二、容器_

Minesweeping games - easy to play addictive (C language version)

HTAP是有代价的

论文阅读-MLPD:Multi-Label Pedestrian Detector in Multispectral Domain(海康威视研究院实习项目)

STM32驱动HC05蓝牙串口通信模块

Real time synchronization and conversion of massive data based on Flink CDC

Redis master-slave replication principle
随机推荐
Why is redis so fast? Redis threading model and redis multithreading
Why BGP server is used in sunflower remote control? Automatic optimal route and high-speed transmission across operators
How do children's playgrounds operate?
面试官:如何处理高并发?
Minesweeping games - easy to play addictive (C language version)
回溯——491. 递增子序列
论文阅读-MLPD:Multi-Label Pedestrian Detector in Multispectral Domain(海康威视研究院实习项目)
Pytorch深度学习快速入门教程 -- 土堆教程笔记(一)
V01 - XX,记录美好生活从日志开始
On the construction and management of low code technology in logistics transportation platform
How RFID works
回溯——第51题. N皇后——必须攻克的经典回溯难题
羽毛球馆的两个基础设施你了解多少?
Introduction to FPGA (III) - 38 decoder
[wechat applet] read the article, data request
【2243】module_ param.m
Flink's real-time data analysis practice in iFLYTEK AI marketing business
The map function counts the number of occurrences of characters
Ssj-21b time relay
el-form 每行显示两列,底部按钮居中