EBK DATA STRUCTURES AND ALGORITHMS IN C
EBK DATA STRUCTURES AND ALGORITHMS IN C
4th Edition
ISBN: 9781285415017
Author: DROZDEK
Publisher: YUZU
Question
Book Icon
Chapter 1, Problem 14E
Program Plan Intro

Virtual function member :

  • A member function that can be declared within a base class is known as virtual function.
  • A derived class can redefine a virual function member.
  • Preceding the function declaration, a keyword “virtual” is used for creating a virtual function in base class.
  • While inheriting a class with virtual function, the virtual function is redefined by the derived class as per its needs.
  • Virtual function call is been resolved at the run time whereas non virtual member functions resolves at compile time.
  • Virtual function call is computationally more expensive than function call that is non virtual.
  • Virtual functions use pointer invocation, indirection and a few extra instructions are required than normal member functions.
  • The constructor of any class that would contain virtual functions are been required to initialize a table of pointers to its virtual member functions.

Non-virtual function member :

  • Non virtual function members are resolved statistically.
  • Non virtual member function is been selected statically based on the type of pointer to the object.
  • Unlike virtual function member, no runtime activities happens in non virtual member functions, since the compiler resoles non virtual functions at compile time based on the type of pointer.

Blurred answer
Students have asked these similar questions
Describe the performance considerations when heavily utilizing function objects.
what are the rules for virtual function?
Local declarations are those that are kept in the memory of the computer; but, how exactly are they kept in memory? If reaching one's objective can be done without making use of local declarations, then doing so is a waste of time. Why bother using value parameters when you can just use references as your arguments in any function? How crucial are value parameters when it comes to the processing of programmed data?
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education