Languages-C & C Plus Plus [3i Infotech Placement]: Sample Questions 311 - 312 of 354

Glide to success with Doorsteptutor material for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.

Question 311

C & C Plus Plus

Describe in Detail


What is generic functions and generic classes?


Generic Function

  • A function declared with type parameter is generic function.
  • When called, actual types are used instead of the type parameters.
  • Used to create template describing what a function will do.
  • A template is a blueprint or formula for creating a generic class of a function.
  • Each parameter represents data types with class keyword.
  • After that function name for generic function will defined.
  • The library container like iterators and algorithms are example of generic programming and developed using template concept.

Generic Classes

  • The behaviour of a generic container class does not depend on the kind of elements stored in the container.
  • It describes the functionality without bound to any data type.
  • Used to generate definitions of classes which are bound to a particular data type.
  • Example is array class.
  • Functionality of array class will the same irrespective of the array members are int, float, or string.

Question 312

C & C Plus Plus

Write in Short

Short Answer▾

What is an opaque pointer?


  • A pointer is opaque if definition of the type to which it points to is not included in the current translation unit.
  • A translation unit results by merging an implementation file with all its headers and header files.
Given the the Opaque Pointers to an Instance of a Struct Defined in the Class Implementation File

Developed by: