See? I have two objects, and I´d like to modify their content from one single function definition and declaration in a similiar way. It feels like a waste of code declare so many functions for each class or struct, unless there is some way to set struct itself as parameter... Hmm...
I hope you understand what I´m looking after. I need help!
Unfortunately I don´t understand exactly what do you mean, Bazzy... Are you talking about inheritance and/or abstract classes? Please show me/us some code, I´m a visual person and I´ll get things better when I can see something. Thanks for your effort.
But there´s one problem: the value it is supposed to print is invalid (1076296996) instead of 10 of yours. Man, my code has problems... I got the idea and learnt something cool (thanks Bazzy), but my reference may need some fixes yet. Any help, please?
That's fine. but all the structure's cannot have the same parameters. if the structure's change, your template class will be non usable. you may need a way to identify the objects.
Alright, I figured this one out; I was thinking too complexly albeit the solution would have been this simple - just add the reference operator right at the beginning of object parameter and cut off the other crap out of the main function:
IMHO, a more formal & elegant approach was to use a base class. I mean, you say that different structures have a common set of attributes. To me that just cries for a base class. But that's just me, I guess.
I understand what you mean - the inheritance, and yes, it is good idea indeed. Of course in code above it doesn´t work, but often times it really helps you out. Nice suggestion, webJose!