Binding refers to the process of converting identifiers (such as variable and performance names) into addresses. Binding is done for each variable and functions. For functions, it means that matching the call with the right function definition by the compiler. It takes place either at compile time or at runtime.
Early Binding (compile-time time polymorphism) As the name indicates, compiler (or linker) directly associate an address to the function call. It replaces the call with a machine language instruction that tells the mainframe to leap to the address of the function.
By default early binding happens in C++. Late binding (discussed below) is achieved with the help of virtual keyword)
Late Binding : (Run time polymorphism) In this, the compiler adds code that identifies the kind of object at runtime then matches the call with the right function definition (Refer this for details). This can be achieved by declaring a virtual function.
- Structured binding in C++
- Rust vs C++: Will Rust Replace C++ in Future ?
- Priority queue of pairs in C++ with ordering by first and second element
- Implementation of lower_bound() and upper_bound() in Vector of Pairs in C++
- Generating RGBA portable graphic images through C++
- std::basic_istream::ignore in C++ with Examples
- std::basic_istream::getline in C++ with Examples
- Format specifiers in different Programming Languages
- std::is_heap( ) in C++ with Examples
- std::basic_istream::gcount() in C++ with Examples
- new vs malloc() and free() vs delete in C++
- std::string::rfind in C++ with Examples
- Sum of factorials of Prime numbers in a Linked list
- Sum of all Palindrome Numbers present in a Linked list
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.