GATE (Graduate Aptitude Test in Engineering) Computer Science & IT (CS) Programming and Data Structures-Abstract Data Types Study Material (Page 14 of 24)

Choose Programs:

🎓 Study Material (1190 Notes): 2024-2025 Syllabus

Rs. 1000.00 -OR-

3 Year Validity (Multiple Devices)

Topic-wise Notes & SampleDetails

🎯 302 Numeric, 2894 MCQs (& PYQs) with Full Explanations (2024-2025 Exam)

Rs. 650.00 -OR-

3 Year Validity (Multiple Devices)

CoverageDetailsSample Explanation

Help me Choose & Register (Watch Video) Already Subscribed?

Function Templates

Edit

Introduction

The template is a unique feature of the C ++ language. A template is an outline or a sketch of a class or a function, which can later be converted to a specific type of a class or function, based on user՚s requirement. Whenever the function or a class with specific type is defined, this template is used to generate a copy of a function or a class for that specific type. The idea of template is derived from the need of two different camps. One camp wants to preserve the efficiency of the C language while the other camp demands generic solutions to problems, for example, designing …

… (1924 more words) …

Subscribe (by clicking here) to view full notes and track progress.

Implementing Runtime Polymorphism

Edit

Introduction

Here, we will look at how virtual functions are defined and used to achieve runtime polymorphism. We will extend our discussion of the Shape class hierarchy through an example and see how that can be used to implement runtime polymorphism.

The Need for a Virtual Function

Let us try to see where these virtual functions make sense. Consider a video game in a virtual world. The user encounters many obstacl…

… (770 more words) …

Subscribe (by clicking here) to view full notes and track progress.