hey guy this my code on file h and i need to create method that need to print the type.
#include <iostream>
#include <typeinfo>
using namespace::std;
template <class T>
class Set {
T* group;
int size_group;
public:
Set():group(NULL),size_group(0){};
Set(T*,int);
Set(const Set<T>&);
~Set();
void PrintObj()const;
bool isThere(const T&)const;
void getType()const;
};
template <class T>
void Set<T>::getType() const{
cout << "The type is: " << typeid(*this).name() << endl;
}
Main:
#include "Set.h"
int main() {
int arr[] = {1,4,5,6,3,2};
int arr2[] = {5,2,6};
Set<int> j(arr,(sizeof(arr)/sizeof(arr[0]))),l(arr2,sizeof(arr2)/sizeof(arr2[0])),k;
j.getType();
}
OUTPUT:
The type is: 3SetIiE
how i can print the type name? It kind of gibberish to me