Generic Subprograms

March 27, 2019 · Team EasyExamNotes · 1 min read (est.) · 2 comments

Share on WhatsApp
GENERIC SUBPROGRAMS
  • A generic subprograms is a subprogram which have parametric polymorphism.
  • A generic subprogram can accept different types of values of same single memory location.
  • Parametrically polymorphic subprograms are often called generic subprograms.
  • C++ provide a kind of compile-time parametric polymorphism.

For example Generic Functions in C++:

template <class Type>
void show(Type a) {
cout<<a;
}
void main()
{
show(10);
show(10.2);
show(‘c’);
}

Lecture video on Generic Subprograms

References:

  1. Sebesta,”Concept of programming Language”, Pearson Edu 
  2. Louden, “Programming Languages: Principles & Practices” , Cengage Learning 
  3. Tucker, “Programming Languages: Principles and paradigms “, Tata McGraw –Hill. 
  4. E Horowitz, “Programming Languages”, 2nd Edition, Addison Wesley 

Discussion

Ask a question, share your thoughts or report an error.

2 comments

Sign in to participate in the discussion.

Join the discussion