2078 10

Object Oriented Programming20785 marksClass templates

When class templates are useful? How can you define a class that can implement stack with integer as well as sack of strings? Illustrate with example.

When class templates are useful? How can you define a class that can implement stack with integer as well as sack of strings? Illustrate with example. [5]

Class templates are useful when: - You need to create a class that performs the same operations on different data types (int, float, string, etc.) - You want to avoid code duplication by writing a single generic class instead of separate classes for each data type - You want type safety along wit...

Up nextWhat is meant by stream? Write a program that reads content of file data.txt and displays