Need explanation with something

Discussion in 'C++' started by Daniel Vukadinovic, Apr 22, 2006.

  1. Can anyone explain me these things in C++?

    1.What is :: used for like in the next case:

    if(....
    {
    ...

    ::eek:ne;

    ...
    }
    ....

    2.Do I understand this right?
    void something::something:something(...
    Is the last something followed after only one : a subclass?

    3.What does this mean?
    struct something
    {
    ...
    } a; ->> what is this used for?

    4.Static, const and mutable
    Now I read alot about that but I never really understood when do we use
    static, const and mutable with variables? I know const is used when we
    don't want the value to be changed, but what's static and mutable? I
    would appreciate examples so I could understand it better.
    Daniel Vukadinovic, Apr 22, 2006
    #1
    1. Advertising

  2. Daniel Vukadinovic wrote:
    > Can anyone explain me these things in C++?
    >
    > 1.What is :: used for like in the next case:
    >
    > if(....
    > {
    > ...
    >
    > ::eek:ne;


    The '::' is a _scope_resolution_ operator. So, it helps resolve
    (or override) the scope.

    >
    > ...
    > }
    > ...
    >
    > 2.Do I understand this right?
    > void something::something:something(...

    .. ^
    .. A colon is missing here

    > Is the last something followed after only one : a subclass?


    Impossible to say.

    > 3.What does this mean?
    > struct something
    > {
    > ...
    > } a; ->> what is this used for?


    Declares an object of that type.

    > 4.Static, const and mutable
    > Now I read alot about that but I never really understood when do we
    > use static, const and mutable with variables? I know const is used
    > when we don't want the value to be changed, but what's static and
    > mutable? I would appreciate examples so I could understand it better.


    What book are you reading that doesn't explain those?

    V
    --
    Please remove capital As from my address when replying by mail
    Victor Bazarov, Apr 22, 2006
    #2
    1. Advertising

  3. I know the theory of my problems but I don't know how to use them in
    real life.I know a; is a object of that type, but what does that mean?
    You know?
    I have two my local colledge textbooks and some e-books but I still
    don't get it.
    Daniel Vukadinovic, Apr 22, 2006
    #3
  4. Daniel Vukadinovic wrote:
    > I know the theory of my problems but I don't know how to use them in
    > real life.I know a; is a object of that type, but what does that mean?
    > You know?


    struct something
    {
    ....
    } a;

    Is just short for

    struct something
    {
    ....
    };
    something a;

    Pure syntactical sugar.
    Markus Schoder, Apr 22, 2006
    #4
  5. Daniel Vukadinovic wrote:

    Please quote the message you are answering to.

    > I know the theory of my problems but I don't know how to use them in
    > real life.I know a; is a object of that type, but what does that mean?


    Every object has a type which defines, among other things, the
    operations you can do on that object. I strongly recommend

    1) browsing the FAQ (http://www.parashift.com/c -faq-lite/)
    2) buying a good book (Accelerated C++ from Koenig and Moo is usually
    recommended)
    3) starting to actually program, this will help you understand the
    "theory of your problems"

    > I have two my local colledge textbooks and some e-books but I still
    > don't get it.


    Change them. See www.accu.org for suggestions.


    Jonathan
    Jonathan Mcdougall, Apr 22, 2006
    #5
  6. Thank you all for your replies!
    Daniel Vukadinovic, Apr 22, 2006
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kaladhaur Palaniappa

    Need Explanation

    Kaladhaur Palaniappa, Aug 7, 2003, in forum: Perl
    Replies:
    0
    Views:
    995
    Kaladhaur Palaniappa
    Aug 7, 2003
  2. Dave
    Replies:
    4
    Views:
    386
  3. darrel
    Replies:
    0
    Views:
    396
    darrel
    Oct 20, 2004
  4. 0k-
    Replies:
    4
    Views:
    263
    Steven D'Aprano
    Jan 18, 2007
  5. Replies:
    9
    Views:
    205
    Keith Thompson
    Mar 10, 2013
Loading...

Share This Page