On Oct 10, 2013 12:45 AM, "Rob Myers" <r...@robmyers.org> wrote: > > On 09/10/13 01:46 PM, James Morris wrote: > > // c++ > > rob@hacienda:~$ cd Desktop/ > rob@hacienda:~/Desktop$ emacs object_lesson.cpp & > [1] 27185 > rob@hacienda:~/Desktop$ make object_lesson > g++ object_lesson.cpp -o object_lesson > rob@hacienda:~/Desktop$ ./object_lesson > int value: 67 > is I > float val: 0.675 > is F > rob@hacienda:~/Desktop$ > > As an alternative to member function overloading, this could be done at > compile-time with template specialization. >
yes, this particular case could be. the idea though was for intermixing three (currently distinct) types in containers which for a user should be associated, but which currently are segregated, causing mildly muddied associations. I started off trying to overload the base constructor to dictate the type of object created but of course this doesn't work in c++, realized that pretty much after a few lines but couldn't remember if static member functions could be overloaded out not. note also the effort to constrain as much as possible the access route to creating these objects. lastly, the base destructor should be virtual ( -Wextra ) thanks for looking. _______________________________________________ > NetBehaviour mailing list > NetBehaviour@netbehaviour.org > http://www.netbehaviour.org/mailman/listinfo/netbehaviour
_______________________________________________ NetBehaviour mailing list NetBehaviour@netbehaviour.org http://www.netbehaviour.org/mailman/listinfo/netbehaviour