Advertisement
Guest User

Untitled

a guest
Aug 17th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #include "pch.h"
  2. #include <iostream>
  3. #include <string>
  4. #include <typeinfo>
  5. using namespace std;
  6. template<class T>
  7. class TypeInfo {
  8. public:
  9. T value;
  10. int DataTypeSize() {
  11. return sizeof(value);
  12. }
  13. TypeInfo(T value) {
  14. this->value = value;
  15. }
  16. };
  17. template<class T>
  18. class SIZE :public TypeInfo<T> {
  19. public:
  20. SIZE(T value):TypeInfo<T>(value) {};
  21. void TYPEID() {
  22. cout<<"Typename:"<< typeid(value);
  23. }
  24. };
  25. int main() {
  26. TypeInfo <double> a(3123);
  27. cout<<a.value;
  28. return 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement