Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "pch.h"
- #include <iostream>
- #include <string>
- #include <typeinfo>
- using namespace std;
- template<class T>
- class TypeInfo {
- public:
- T value;
- int DataTypeSize() {
- return sizeof(value);
- }
- TypeInfo(T value) {
- this->value = value;
- }
- };
- template<class T>
- class SIZE :public TypeInfo<T> {
- public:
- SIZE(T value):TypeInfo<T>(value) {};
- void TYPEID() {
- cout<<"Typename:"<< typeid(value);
- }
- };
- int main() {
- TypeInfo <double> a(3123);
- cout<<a.value;
- return 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement