I have a linked list. With and object type of another class.
It works.
How would you count objects of the same name generally? what is your approach?
e,g'
object is foo.
if I add another foo object to my list with the name of foo?
how would you count an new object? would you overload ++ -- ? posfix prefex?
or would you add a data member to the object called count and then increment it algorithmically?
Are you talking about objects of the same type or objects with the same name? Those are 2 very different things so you have to be more precise.
If you are referring to type, then simply incrementing a counter variable will do the trick. Unless you are dealing with polymorphism, then you might just have to overload a count method for each object type.