C++ Programming - OOPS Concepts - Discussion

Discussion :: OOPS Concepts - General Questions (Q.No.49)

49. 

Which one of the following is correct about the statements given below?

  1. All function calls are resolved at compile-time in Procedure Oriented Programming.
  2. All function calls are resolved at compile-time in OOPS.

[A]. Only II is correct.
[B]. Both I and II are correct.
[C]. Only I is correct.
[D]. Both I and II are incorrect.

Answer: Option C

Explanation:

No answer description available for this question.

Nazmul said: (May 3, 2013)  
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: (Oct 22, 2013)  
While creating objects we are indirectly calling constructors. So all functions cannot be be resolved by compiler alone.

John said: (Oct 29, 2014)  
What about calling a function in C by pointer to function? Isn't that kind of dynamic?

Abhijeet said: (Jan 19, 2016)  
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.

Mani said: (Aug 12, 2017)  
Can you clear me why All function calls are resolved at compile-time in Procedure Oriented Programming?

Rohit Ghadge said: (Jun 1, 2019)  
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.

Post your comments here:

Name *:

Email   : (optional)

» Your comments will be displayed only after manual approval.