Clarification on '::' definition and 'tilda' symbol

This is a discussion on Clarification on '::' definition and 'tilda' symbol within the C++ Programming forums, part of the General Programming Boards category; // Various include files #include "RetCodes.h" #include "BeltMsg.h" #include "QPager.h" // #include "wheresub.h" #include "y2k.h" #include "Ymdhms.h" #include "TimeRep.h" #include ...

  1. #1
    Registered User
    Join Date
    Mar 2002
    Posts
    3

    Question Clarification on '::' definition and 'tilda' symbol

    // Various include files
    #include "RetCodes.h"
    #include "BeltMsg.h"
    #include "QPager.h"
    // #include "wheresub.h"
    #include "y2k.h"
    #include "Ymdhms.h"
    #include "TimeRep.h"
    #include "TimeStamp.h"
    #include "Duration.h"


    // Definition of the maximum length of a CUBE computer page
    const int MAX_COMP_PAGE = 256;



    BeltMsg::BeltMsg() : DBScript() //What does the '::' mean?
    {
    }


    BeltMsg::~BeltMsg() //What does '~' in front of BeltMsg mean?
    {
    }


    int BeltMsg::Run()
    {
    Origin or;
    Magnitude mag;
    qpager_data_type qpage;
    char belttext[MAX_COMP_PAGE];

    // Get the origin
    or = (*(event.origins.begin()));

    // Get the magnitude
    mag = (*(or.mags.begin()));

    // Initialize the QPager routines
    QInit(townfile, faultfile);

    // Create and send pages
    strcpy(qpage.message_type, "Event");
    qpage.event_id = event.evid;
    strcpy(qpage.data_source, "Pasadena");
    qpage.event_version = nmod;

    // Create ymdhms from the eqtime.long()
    struct ymdhms localtim;
    struct ymdhms gmttim;
    Last edited by hugo; 03-13-2002 at 03:40 PM.

  2. #2
    Registered User bljonk's Avatar
    Join Date
    Oct 2001
    Posts
    70

    Wrong Address Dude!

    goto: C++_programming_board

    Do not try this at home alone *(spague code)

    defining something *(method) from class x
    x::something(){...};
    Ünicode¬>world = 10.0£

  3. #3
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    ~function( ); //denotes that this is a 'destructor' function.

    :: is basicly used to tell us that the function we're defining belongs to the class to the left of the ::. Example:

    MyClass::MyFunction( ) {

    }

    Function 'MyFunction' belongs to 'MyClass'.

    And yes, you're in the wrong place. The C++ board is what you want.

    Quzah.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

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