Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors

Generic Subprograms

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 

Leave a Comment