[Nottingham] C++ Programming

Alex Tibbles alex_tibbles at yahoo.co.uk
Thu Oct 16 11:26:14 BST 2003


 --- David Bean <david at dbean.uklinux.net> wrote: > Can
anyone recommend a good mailing list for a c++
> newbie. I've spent
> three days learning c++, and am stumped how to
> implement something
> without using function pointers.

try comp.lang.c++ (news) and the .moderated subgroup.
i picked up the basics from the paper version of the
C++ faqs from that ng - available online (eg.
faqs.org).

The C++ version of function pointers are functors -
google for them. Basically they overload operator() -
eg:

class Bleg
{
    public:
        void operator()(int);
};

Blegs are now functors:

int main()
{
    Bleg bleg;
    bleg(3);
}

You can do lots of things with functors that are hard
(to say the least) to do with function pointers. The
standard library provides base classes interfaces
(std::unary_function<>) which is a template - so i'd
leave that until you've got templates learned, if you
havn't grasped them yet.

alex

________________________________________________________________________
Want to chat instantly with your online friends?  Get the FREE Yahoo!
Messenger http://mail.messenger.yahoo.co.uk



More information about the Nottingham mailing list