What do you mean by binding of data and functions?

Encapsulation.  

Showing Answers 1 - 8 of 8 Answers

vvvv

  • Sep 16th, 2005
 

Encapsulation is the concept to binding of data and functions.The data members are allowed to access by appropriate class functions or methods.Data members can't access from outside class.

  Was this answer useful?  Yes

Ambika Prasan Sahoo

  • Apr 20th, 2007
 

Generally  the data member are only accessed by the member function not by outside function is known as data binding to those function.

And scope of the data member is within the class scope.

  Was this answer useful?  Yes

Data binding is the process of binding the data objects used by the program/application with the actual physical memory. Data Binding is further classified into two sub-concepts - Early binding, and late binding.
Early binding is the process of binding the data objects and the physical memory at compile time. In this process, the memory is allocated to the data objects when the application/program is loaded into the memory for execution. All declarations of standard objects (e.g., int x; char y; MyClass myCls; etc) use early binding.
Late binding is the process of associating/allocating memory to the objects at run-time, when these objects are dynamically created. At compile time, minimal memory is bound to these objects. Typically, these are pointers. For example, int* x[25]; is a pointer to 25 integers. At compile time, 4 bytes of memory is allocated for the pointer itself. When a malloc, calloc, or new operator is used to allocate memory for x[25] ( x = new int[25];), that's wheen the actual memory is allocated to hold 25 integers. Until such time, no binding is done.

  Was this answer useful?  Yes

Apologies. Looks like I did not read the question properly in my previous answer.

Binding data and functions:
One of the OO features supported by C++ is Encapsulation. Encapsulation is to have data and methods that can manipulate the data combined together in a single capsule (Object or Class).
So, in theory, each C++ class has some (hopefully private) data members and (hopefully) some public members that can manipulate the data. These methods can be used to manipulate the data, when an instance of the class is created in an application. The way memory is allocated for a class instance is as follows.

1. Memory for method code - per class used in the application. All member methods of the class are loaded here.
2. Memory for data members - per instance of the class. This memory is associated with a specific instance of the class. Each instance has its own data area in the memory where the data is manipulated. When a member function is invoked using an object, the member method (in addition to its standard parameter list) will also take an invisible pointer parameter of the object's class tipe (called this). When the member method acts on the data, it is acting on the object pointed to by this pointer. The this pointer is pointing to the unique data area (memory) allocated specifically for the object being referenced.

This is how data and member functions are bound together in C++.

  Was this answer useful?  Yes

neelu7779

  • Jul 31st, 2008
 

Binding in context to functions means "Linking of a function call to the code to be executed in response to the function call"

  Was this answer useful?  Yes

Vatsa

  • Apr 6th, 2016
 

Hi SomGollakota,
Can you please give clear explanation on this . I am little confused. I am not getting what you are trying to tell please explain.

  Was this answer useful?  Yes

Ranjeet

  • Feb 14th, 2023
 

In general, binding of data members and member function is known as encapsulation.
It means the data of that class Or object can be only access by that classs function. Its cant access by outsider function.

  Was this answer useful?  Yes

Navya B

  • Jan 4th, 2024
 

Encapsulation

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions