By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,640 Members | 2,355 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,640 IT Pros & Developers. It's quick & easy.

Need explanation with something

P: n/a
Can anyone explain me these things in C++?

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

if(....
{
...

::one;

...
}
....

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.

Apr 22 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Daniel Vukadinovic wrote:
Can anyone explain me these things in C++?

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

if(....
{
...

::one;
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
Apr 22 '06 #2

P: n/a
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.

Apr 22 '06 #3

P: n/a
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.

Apr 22 '06 #4

P: n/a
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

Apr 22 '06 #5

P: n/a
Thank you all for your replies!

Apr 22 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.