C++ Programming - OOPS Concepts - Discussion
Discussion Forum : OOPS Concepts - General Questions (Q.No. 49)
49.
Which one of the following is correct about the statements given below?
- All function calls are resolved at compile-time in Procedure Oriented Programming.
- All function calls are resolved at compile-time in OOPS.
Discussion:
7 comments Page 1 of 1.
Mani said:
8 years ago
Can you clear me why All function calls are resolved at compile-time in Procedure Oriented Programming?
(2)
Rohit ghadge said:
6 years ago
Answer is right.
C supports only "Early Binding" in which all the functions related to their function calls are resolved at compile time.
C++ Supports both "Early Binding" and "Late Binding". Late Binding is the process of resolving functions related to function calls during Run time.
In C++ virtual calling mechanisms are resolved at run-time.
Hence, Option (c) only 1 correct.
C supports only "Early Binding" in which all the functions related to their function calls are resolved at compile time.
C++ Supports both "Early Binding" and "Late Binding". Late Binding is the process of resolving functions related to function calls during Run time.
In C++ virtual calling mechanisms are resolved at run-time.
Hence, Option (c) only 1 correct.
(1)
Nazmul said:
1 decade ago
Because when you create an object of a class you indirectly call the constructor function of that class. So, in OOPS, all functions are not resolved at compile time only.
Ghost in c++ said:
1 decade ago
While creating objects we are indirectly calling constructors. So all functions cannot be be resolved by compiler alone.
John said:
1 decade ago
What about calling a function in C by pointer to function? Isn't that kind of dynamic?
Abhijeet said:
10 years ago
Going through above discussion I feel that the answer is wrong.
Example:
struct Emp
{
char name[10+1];
int age;
};
int main()
{
struct Emp e;
int *ptr = malloc(sizeof(e));
}
Malloc get resolved at run time and not compile time. Similarly calloc, realloc.
Example:
struct Emp
{
char name[10+1];
int age;
};
int main()
{
struct Emp e;
int *ptr = malloc(sizeof(e));
}
Malloc get resolved at run time and not compile time. Similarly calloc, realloc.
Arnab Pratihar said:
4 weeks ago
In C there is no concept of compile time and runtime, so all function calls are resolved at compile time, but in OOPs, there are two different concepts of compile time and runtime.
Some types of functions are resolved at compile time, and some are at runtime, but this question mentioned that all functions are resolved at compile time, which is absolutely wrong.
Some types of functions are resolved at compile time, and some are at runtime, but this question mentioned that all functions are resolved at compile time, which is absolutely wrong.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers