C++ Template Type to Non-Type Constructor- destructor -

Objectives :

  • This example resembles myClassTemplate2.htm
  • In this example Type parameters in the class were handled with constructors for string and Primitive data-type parameter -- implicitly, ( meaning we did not enforce type-specific conversion or explicit conversion)
  • Class constructors (Non-Types) and destructor
  • Code : myClassTemplate3.txt

Step: 1 Create a project myClassTemplate3

Step: 2 Create a source file

Step: 3 Edit Source code

Although we did not create any constructor to handle the parameters that would pass double data type variables, the constructor for integer data type will be enforced as a best choice. This will mutate the actual data-type.

Non-Type data mixing is not permitted

Step: 4 Runtime View

Step: 5b