Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- template <class DynamicType>
- DynamicType areaOfTheCircle(DynamicType radius)
- {
- return 3.1415 * radius * radius;
- }
- int main()
- {
- int x = 2;
- int result = areaOfTheCircle<int>(x);
- cout << "Area: " << result << endl;
- cout << "Result variable type: " << typeid(result).name() << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement