bug-commoncpp
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: help for cpp code


From: Federico Montesino Pouzols
Subject: Re: help for cpp code
Date: Wed, 24 Dec 2003 14:35:57 +0100
User-agent: Mutt/1.5.4i

        I think it is a good idea, particularly now that we are in the
process of making 1.1 and new ideas can be incorporated. 

On Tue, Dec 23, 2003 at 04:39:59PM -0500, David Sugar wrote:
> Do you think we should have a channel on freenode?  Do you think if we do 
> people will actually come?
> 
> On Tuesday 23 December 2003 03:30 pm, Marc Boris Dürner wrote:
> > On Tuesday 23 December 2003 13:35, Dheerendra Kulkarni wrote:
> > > Please help me in what this code means
> > >
> > > NRLOLSR::NRLOLSR(nsaddr_t id) : Agent(PT_NRLOLSR),htimer(this),
> > > ttimer(this) {
> > > ...
> > > ..
> > > ..
> > > ..
> > >
> > > };
> > >
> > > This is actually a constructor for a class called NRLOLSR now I don't
> > > Understand what does literals following ':' mean (will they call
> > > functions
> > >
> > > which are given there or what)
> > > Dheerendra Kulkarni
> >
> > There should really be a CommonC++ channel on IRC  :) Also try #c++ on
> > irc.freenode.net for questions like this in the future.
> >
> > I is called the initialiser-list. The items in that list are initialised
> > before the constructor is
> > called. The initialiser list is used to:
> >
> > - pass parameters to the constructor of a base class
> > - initialise member variables
> >
> > Take the following example:
> >
> > //
> > // A simple class A with a int as a private member.
> > // Here the initialiser list is used to set the private member
> > // to what is passed in to the consructor
> > //
> > class A {
> >    public:
> >    A(int i) : _number(i) {}
> >    ~A() {}
> >    private:
> >    int _number;
> > };
> >
> > //
> > // A simple class B also with a private member. Here
> > // the initialiser list is used to call the constructor of the
> > // base class A and to set the member _ othernumber to 5
> > //
> > class B : public A {
> >    public:
> >    B() : A(3), _othernumber(5) {}
> >    ~B() {}
> >    private:
> >    int _othernumber;
> > };
> >
> >
> > regards,
> > Marc
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]