You are here:

C++/what is data binding

Advertisement


Question
sir,
 I have some doubts in C++.Now i am sending some of the questions.

1)what do u mean by binding of data and functions?
2)what is the difference between procedure oriented language and object oriented laguage?
3)when is memory allocated to class?
4)what happens when we compile a  program & when we execute a  program.
  please give me clear explanation.

Answer
Hello Chinna, thank you for the question.

Number 1: By data binding I'm assuming that means storing data in a variable. I'm not familiar with that term, but my guess seems to make sense. Yes, one of the principles of the C++ language is the ability to store data in variables for program use. A simple example would be an integer: int x = 5; There now we have just binding the number "5" to the variable "x". "x" can be substituted for 5 anywhere within the scope of that variable now. A function is a way of writing common code such that you don't have to copy and paste code all over your program. For example, maybe you need to ask 5 people for their user names and passwords in a program. Instead of copying and pasting the code to do that 5 times you can put it in a function and just call the function 5 times instead.

Number 2: Procedure oriented language(POL) is based around functions instead of objects. There is no concept of classes or data encapsulation. Since there is no concept of the invoking object in POL, all the functions usually take in a pointer to the object they need to manipulate as a first parameter. C is a very common POL. Object oriented language(OOL) is based on individual objects and code modularity. It uses classes to help further define what variables and functions would be required/helpful for each of that particular object to have. OOL also makes use of top/down program building more ofter than POL because of inheritance. You can create an object class which contains all the variables and functions common to an object in your program, then inherit a player class, and enemy class, a tree class, even maybe a class to represent a rock in your world, since all of those need common variables and functions to manipulate them. C++ and Java are common OOL.

Number 3: This question has been worded vary vaguely. If you wish to be more explicit, then I'll go back and answer this one again. When you create a class and add all of its variables and functions, no memory is actually allocated. When you instantiate an object of this class, I'm fairly sure that is the answer you're looking for. You just created an object, and its memory has been allocated. By the most correct answer would be to say when the program is executed and that line of code is ran. Then the memory is actually stored in your computer.

Number 4: Compiling a program checks for syntax errors, builds the program, and links the program into an executable file. Executing a program actually runs it. If you have any other questions please don't hesitate to ask.

I hope this information was helpful.

- Eddie

C++

All Answers


Answers by Expert:


Ask Experts

Volunteer


Eddie

Expertise

I can answer questions about the C++ language, object oriented design and architecture. I am knowledgable in a lot of the math that goes into programming, and am certified by ExpertRating.com. I also know a good deal about graphics via OpenGL, and GUIs.

Experience

I have completed numerous games and demos created with the C++ programming language. Currently employed as a software engineer in the modeling and simulation field. I have about 7 years experience.

©2016 About.com. All rights reserved.