I am a situation where I am trying to implement something I'm not sure is supported by C++.
Say for example:
class foo
{
public:
type item1;
type item2;
}
class fooList
{
public:
foo list;
type getFooMember(member)
{
return list.member
}
}
Is there a way to write a function "getFooMember"? Essentially I am writing a templated binary search tree. I am looking to store items of the same type, however, one object of the class will store by name and the other will store by month. I wanted to reduce repetitive code. The easiest solution I can think of is:
type getFooItemOne()
{
return list.item1;
}
type getFooItemTwo()
{
return list.item2;
}
However, my add and search functions are around 20 lines and I wanted to see if I could avoid that.
Thanks guys