CS304 Current Final Term Paper 2022

Are you looking for CS304 Current Final Term Paper 2022? So, you are on right platform its CS304 Current Final Paper 2022. Its very helpful for your final term preparation in CS304. Its also a helping material for yourself because its defines CS304 Final Important Topics. 

CS304 Current Final Term Paper 2022

Question No 44:

Can a complete specialization or ordinary class be inherited from a class template? Justify in either case?

Answer:

Complete specialization or ordinary class cannot inherit from a class template because as you can see complete specialization is in fact instance of the class for one data type and in this way, it is similar to ordinary class as ordinary class also can be instantiated for its members of a particular data type.

Question No 45:

What is template class and why class templates are used?

Answer:

A template class in C++ is a class that allows the programmer to operate with generic data types. This allows the class to be used on many different data types as per the requirements without the need of being re-written for each type. Templates are powerful features of C++ which allows us to write generic programs. A class template provides a specification for generating classes based on parameters. Class templates are generally used to implement containers. A class template is instantiated by passing a given set of types to it as template arguments.

Question No 46:

Suppose we have a Person class with an attribute age and we want another class Voter with some attribute but with restriction that age can only be greater than 18 years. Both classes have a SetAge function that set their respective attribute age with passed value if value is fulfilling, the classes conditions (value is greater than zero in case of Person class and value is greater than 18 in case of Voter class).

You are to give the code of implementation of this specialization relation in terms of classes Person and Voter in C+++.

Question No 47:

Differentiate the Forward and Bidirectional iterators?

Answer:

Bidirectional iterators can iterate in either direction. They are considered as the forward iterators with two decrement operators because they offer the same functionality as the forward iterators, except that they can move in both directions.

Post a Comment

Previous Post Next Post