0

I want to implement hash map, So I want to write a class which will accept object of any class and based on the object size it will return the result.

example:

class A
{
public:
int a;
};

class B
{
char b;
};

my hash map class
??
halfer
  • 19,824
  • 17
  • 99
  • 186
  • 1
    Are you asking "How do template functions work in C++"? – tadman Jan 14 '18 at 04:14
  • 1
    Possible duplicate of [Root base class in C++](https://stackoverflow.com/questions/2399744/root-base-class-in-c) – Jesse Ivy Jan 14 '18 at 04:21
  • "So I want to write a class which will accept object of any class and based on the object size it will return the result." I can't figure out what that means, beginning at "and based on...". – Jive Dadson Jan 14 '18 at 05:12
  • I want a member function which can accept any objects from different class as an argument. – Tuhin Panda Jan 14 '18 at 09:08
  • 1
    Your design is based on the false premise that a hash function should only take an object's size into account and not its value. – Christian Hackl Jan 14 '18 at 11:48

0 Answers0