0

Suppose there is a derived class with a redefined function called print. Now I am accessing the derived class object using a base class pointer p.

Example 1.print() is a virtual function.

p->print() is called.This prints the derived class functionality at dynamic binding.

Example 2. print() is not a virtual function

p->print() is called. This prints the base class functionality. But my question is whether this is static binding or still dynamic binding?

0

1 Answer 1

4

It would generally be considered static binding because which function is called is known and fully determined at compile time.

Sign up to request clarification or add additional context in comments.

2 Comments

It is determined at compile time in both examples.
@Zac A pointer to the base class is used - it's determined at runtime.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.