C Question please type the answer NO writting Give short ans

C++ Question: (please type the answer, NO writting)

-Give short answer.

1) What are the advantages of Templates

2) What is the main problem with Templates

3) What the advantage of static templates in a class

4) Why draw UML-Class diagrams

Solution

Templates are one of the features of the C++ programming language. Its main function is to make the code operate with generic types.
1.
Advantages:
1.As it is generic type,it allows the code reduction.This single function/class definition works with many data types.
2.It saves the space for the source code with the use of templates.
3.The C++ Standard Library provides many useful functions for templates,which helps in achieving multiple inheritance and operator overloading.
2.
Disadvantages/Problems:
1.It takes more Compilation time.Most compilers give cryptic error messages
2.Hard to validate the code.Not easily understandable to everyone.
3.Code bloating.That is compilers generate code for all templated functions in each translation unit that use them.
3
Using of static template function/variable helps to executed this code a t compile time and link all the static functions in the code at compile time only.
4.
The class diagram is a static diagram and it provides the static view of the application.It visually makes us understand the attributes and operations of a class and also the constraints imposed on the system.
class diagram directly maps with any object oriented programming languages.i.e we can relate Java,c++ with the help of class diagram,means its generic for object oriented languages.

C++ Question: (please type the answer, NO writting) -Give short answer. 1) What are the advantages of Templates 2) What is the main problem with Templates 3) Wh

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site