[NetBehaviour] yesterdays object lesson

James Morris jwm.art.net at gmail.com
Thu Oct 10 02:21:18 CEST 2013

On Oct 10, 2013 12:45 AM, "Rob Myers" <rob at robmyers.org> wrote:
> On 09/10/13 01:46 PM, James Morris wrote:
> > // c++
> rob at hacienda:~$ cd Desktop/
> rob at hacienda:~/Desktop$ emacs object_lesson.cpp &
> [1] 27185
> rob at hacienda:~/Desktop$ make object_lesson
> g++     object_lesson.cpp   -o object_lesson
> rob at hacienda:~/Desktop$ ./object_lesson
> int value: 67
> is I
> float val: 0.675
> is F
> rob at 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

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 at netbehaviour.org
> http://www.netbehaviour.org/mailman/listinfo/netbehaviour
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.netbehaviour.org/pipermail/netbehaviour/attachments/20131010/d460a2f6/attachment.htm>

More information about the NetBehaviour mailing list