Using your own creativity, make a set of function templates that have these features: This function must return a value. A function template with 1 template parameter, T. And, any other parameters you want. A function template with 2 template parameters, T1 and T2. And, any other parameters you want.
Using your own creativity, make a set of function templates that have these features: This function must return a value. A function template with 1 template parameter, T. And, any other parameters you want. A function template with 2 template parameters, T1 and T2. And, any other parameters you want.
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
- Using your own creativity, make a set of function templates that have these features:
- This function must return a value.
- A function template with 1 template parameter, T. And, any other parameters you want.
- A function template with 2 template parameters, T1 and T2. And, any other parameters you want.
- Using your own creativity, make a set of class templates that have these features:
- For this class template, put everything in one place--do not declare the member functions and have separate definition of the member functions elsewhere. Keep them in one place.
- Include a private variable.
- Include a constructor that loads the private variable when constructed.
- Include a destructor that clears the private variable to zero.
- Include set and get functions to set and get the private variable.
- For this class template, use declarations for variables and functions, like you do in header file (which you may use if you want).
- Then, separately put the full function definitions for each class member function on their own, like you do in a separate implementation file (which you may use if you want).
- Include at least 2 private variables.
- Include a constructor that loads the private variables when constructed.
- Include a destructor that clears the private variables to zero.
- Include the usual set and get functions to access the private variables.
- Include other functions as you wish.
- A class template with 2 template parameters, T1 and T2.
- EXTRA CREDIT IF YOU USE DYNAMIC MEMORY!
- EXTRA CREDIT IF YOU USE INHERITANCE AND POLYMORPHISM!
- EXTRA CREDIT IF YOU HAVE AN ABSTRACT CLASS.
- EXTRA CREDIT IF YOU CREATE A FRIEND FUNCTION.
- EXTRA CREDIT IF YOU USE STATIC VARIABLES AND STATIC FUNCTIONS!
- Within main ():
- Call your template functions and demonstrate how they work.
- Construct objects and show off your amazing programming skills!
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education