GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Programming  >  C++
Go To First  |  Previous Question  |  Next Question 
 C++  |  Question 13 of 208    Print  
What do you mean by binding of data and functions?
Encapsulation.
 


  
Total Answers and Comments: 5 Last Update: July 31, 2008   
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
September 16, 2005 04:39:41   
vvvv        

RE: What do you mean by binding of data and...
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.
 
Is this answer useful? Yes | No
April 20, 2007 07:06:55   
Ambika Prasan Sahoo        

RE: What do you mean by binding of data and...
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.

 
Is this answer useful? Yes | No
June 13, 2007 02:54:58   
SomGollakota Member Since: June 2007   Contribution: 48    

RE: What do you mean by binding of data and...
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.

 
Is this answer useful? Yes | No
June 13, 2007 03:05:23   
SomGollakota Member Since: June 2007   Contribution: 48    

RE: What do you mean by binding of data and...
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++.

 
Is this answer useful? Yes | No
July 31, 2008 01:49:40   
neelu7779 Member Since: July 2008   Contribution: 1    

RE: What do you mean by binding of data and functions?
Binding in context to functions means "Linking of a function call to the code to be executed in response to the function call"
 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2010 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape