Thread: C++ constructs

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    19

    C++ constructs

    What does c++ constructs mean??

    I'm asking that coz i've been asked to do al listing of all the C++ constructs used in my assigment.

    Does construct mean all the things that exist in C++ but not in C ( coz i'm converting from C++ to C )?? Eg vectors , cin , cout , string, endl ....

  2. #2
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    I do hope it is a small project that one of which they ask you to name ths constructs you used.

    A language construct is basically a part of your program that can be formed by one or more tokens and that is in accordance with the language rules and forms a "language sentence". A token is a string of characters allowed by the language dictionary that, together, form an elemental unit of meaning.

    So...

    int is a token. as is the symbol +, or the operator ::

    int sum_2_numbers (int x, int y) is a construct of the type function.

    int x is a construct known as variable declaration or assignment (on this case your construct is dependant on the context of where it is built)

    class MyClass { /* ..... */ } is a construct of the type class

    So on, so on...

    Basically what I believe you are being asked is to list all language features you addressed in your project.

    Typically this will be,

    Code:
    variable constructs,
    constant constructs,
    function constructs,
    class constructs,
    array constructs,
    string (if you are using the STL defined type) constructs,
    
    etc...
    Hope this helps somehow

  3. #3
    Registered User
    Join Date
    May 2006
    Posts
    19
    thanks a lot!

  4. #4
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    An errata:

    I'm learning C++ myself and I will definitely fall on these traps for a long time. On the above, int x is a variable definition. Not a variable declaration. In fact, it is a variable declaration and definition. Only way to declare a variable without also defining it is by the use of the extern keyword...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Why is goto bad?
    By DarkAlex in forum C++ Programming
    Replies: 28
    Last Post: 12-02-2007, 11:24 AM
  2. semantics
    By anjana in forum Tech Board
    Replies: 4
    Last Post: 10-10-2006, 10:35 AM
  3. undefined and implementation specific constructs
    By curlious in forum C++ Programming
    Replies: 1
    Last Post: 12-18-2003, 05:52 PM