Class definition, the meaning of additional parameters

This is a discussion on Class definition, the meaning of additional parameters within the C++ Programming forums, part of the General Programming Boards category; I can't remember what it means when there are objects,variables stated between a Classes name and the opening brace. An ...

  1. #1
    Registered User
    Join Date
    Jun 2009
    Posts
    24

    Class definition, the meaning of additional parameters

    I can't remember what it means when there are objects,variables stated between a Classes name and the opening brace. An example of what I mean is shown below (taken from the Qwt code) and emboldened.

    Code:
    AttitudeIndicator::AttitudeIndicator(
            QWidget *parent):
        QwtDial(parent),
        d_gradient(0.0)
    {
        setMode(RotateScale);
        setWrapping(true);
    
        setOrigin(270.0);
        setScaleOptions(ScaleTicks);
        setScale(0, 0, 30.0);
        //setRange(0.0,360.0,1.0,1.0);
    
        const QColor color =
    #if QT_VERSION < 0x040000
            colorGroup().text();
    #else
            palette().color(QPalette::Text);
    #endif
    
        setNeedle(new AttitudeIndicatorNeedle(color));
    }
    Could someone tell me what it means to have the lines as shown ?

  2. #2
    The larch
    Join Date
    May 2006
    Posts
    3,573
    This is the initialization list, the only way to actually initialize class members / bases.

    Random link to a tutorial.
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

  3. #3
    Registered User
    Join Date
    Jun 2009
    Posts
    24
    Quote Originally Posted by anon View Post
    This is the initialization list, the only way to actually initialize class members / bases.

    Random link to a tutorial.
    Thanks anon !

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. class definition syntax question
    By R.Stiltskin in forum C++ Programming
    Replies: 8
    Last Post: 01-25-2010, 03:33 PM
  2. Whats the best way to control a global class?
    By parad0x13 in forum C++ Programming
    Replies: 3
    Last Post: 11-12-2009, 04:17 PM
  3. deriving classes
    By l2u in forum C++ Programming
    Replies: 12
    Last Post: 01-15-2007, 04:01 PM
  4. My Window Class
    By Epo in forum Game Programming
    Replies: 2
    Last Post: 07-10-2005, 02:33 PM
  5. class inheritence with constructor parameters
    By drdodirty2002 in forum C++ Programming
    Replies: 3
    Last Post: 06-20-2005, 06:49 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21