Thread: Syntax question

  1. #1
    Registered User
    Join Date
    May 2010
    Posts
    1

    Cool Syntax question

    Hi,

    I am new to the board and am learning C++ programming. I have been searching for guidance on syntax I've seen used, and am not familiar with.

    I don't know what to call it, so will just give an example here (some sort of constructor, using templates, but written in a sort of function shorthand?):

    iterator (dNode<T> *p): nodePtr(p){};

    This line of code, is an iterator type constructor, and specifying a template <T> where p is assigned as a node pointer. But my question here, is what is the 'colon' and the '{}' brackets. Some sort of shorthand for a regular function declaration, but I don't quite know this format. Can anybody tell me a term I can use to search for syntax, so that I can understand better.

    Please excuse any error(s) with my terminology, as I really am trying to grasp this language, but still am a bit confused with a few aspects of such.

    THANKS to all who reply!

    -TED-

  2. #2
    Registered User
    Join Date
    Nov 2007
    Posts
    46
    The colon indicates the start of the initialization list, and the empty curly brackets simply indicate an empty function body.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. quick syntax question
    By klmdb in forum C++ Programming
    Replies: 2
    Last Post: 12-22-2009, 07:25 AM
  2. what am I missing? (Program won't compile)
    By steals10304 in forum C Programming
    Replies: 3
    Last Post: 08-25-2009, 03:01 PM
  3. An error is driving me nuts!
    By ulillillia in forum C Programming
    Replies: 5
    Last Post: 04-04-2009, 09:15 PM
  4. Syntax question: &(++x)
    By yoshiznit123 in forum C Programming
    Replies: 8
    Last Post: 06-02-2006, 10:40 PM
  5. pointer to array of objects of struct
    By undisputed007 in forum C++ Programming
    Replies: 12
    Last Post: 03-02-2004, 04:49 AM