Click here to Skip to main content
15,893,487 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to get visiable item index in a list control of icon style? Pin
Naveen20-Apr-06 20:08
Naveen20-Apr-06 20:08 
GeneralRe: How to get visiable item index in a list control of icon style? Pin
chybin20-Apr-06 20:35
chybin20-Apr-06 20:35 
GeneralRe: How to get visiable item index in a list control of icon style? Pin
Naveen20-Apr-06 21:52
Naveen20-Apr-06 21:52 
GeneralRe: How to get visiable item index in a list control of icon style? Pin
chybin21-Apr-06 18:09
chybin21-Apr-06 18:09 
Questionmap::find , the two overloaded versions have the same pass-in parameters. Does it make sense? Pin
followait20-Apr-06 19:11
followait20-Apr-06 19:11 
AnswerRe: map::find , the two overloaded versions have the same pass-in parameters. Does it make sense? Pin
ThatsAlok20-Apr-06 20:48
ThatsAlok20-Apr-06 20:48 
AnswerRe: map::find , the two overloaded versions have the same pass-in parameters. Does it make sense? Pin
ThatsAlok20-Apr-06 20:57
ThatsAlok20-Apr-06 20:57 
AnswerRe: map::find , the two overloaded versions have the same pass-in parameters. Does it make sense? Pin
John R. Shaw20-Apr-06 21:48
John R. Shaw20-Apr-06 21:48 
Yes. The first one returns an iterator that you can use to manipulate the stored value, the second one does not. There is more to it than that, the second will also be called by other methods that are marked with const without the compiler getting upset.

Try something like this to see the diffence:
class MyClass
{
    public:
        int Func(int i) { return(i); }
        int Test() const { return(Func(0)); }
};

The compiler should complain when you call Test().
class MyClass
{
    public:
        int Func(int i) { return(0); }
        const int Func(int i) const { return(0); }
        int Test() const { return(Func(i)); }
};

The comiler should no longer be complaining, because it can now call a version of Func() that promisses not to change any of the data.

I have not tested these particular examples, but they should work. Note that the return of const int is not needed here, it could be changed to int. The key is the const following the declataion, which is a promise that it will not change the state of the class.

I hope that helps and that you now understand that it does make sense.



INTP
Every thing is relative...
AnswerRe: map::find , the two overloaded versions have the same pass-in parameters. Does it make sense? Pin
jhwurmbach21-Apr-06 1:03
jhwurmbach21-Apr-06 1:03 
QuestionHow to check whether a folder is there in the system Pin
Aryan S20-Apr-06 18:19
Aryan S20-Apr-06 18:19 
AnswerRe: How to check whether a folder is there in the system Pin
Mila02520-Apr-06 19:21
Mila02520-Apr-06 19:21 
GeneralRe: How to check whether a folder is there in the system Pin
Aryan S20-Apr-06 19:31
Aryan S20-Apr-06 19:31 
GeneralRe: How to check whether a folder is there in the system Pin
Mila02520-Apr-06 19:53
Mila02520-Apr-06 19:53 
AnswerRe: How to check whether a folder is there in the system Pin
ThatsAlok20-Apr-06 20:53
ThatsAlok20-Apr-06 20:53 
QuestionRe: How to check whether a folder is there in the system Pin
Aryan S20-Apr-06 21:11
Aryan S20-Apr-06 21:11 
AnswerRe: How to check whether a folder is there in the system Pin
David Crow21-Apr-06 3:30
David Crow21-Apr-06 3:30 
Questiongetting .net runtime from c/c++ Pin
g00fyman20-Apr-06 18:14
g00fyman20-Apr-06 18:14 
QuestionHow can I get the selected text in edit view? Pin
Jacky Tsee20-Apr-06 17:48
Jacky Tsee20-Apr-06 17:48 
AnswerRe: How can I get the selected text in edit view? Pin
_AnsHUMAN_ 20-Apr-06 18:04
_AnsHUMAN_ 20-Apr-06 18:04 
AnswerRe: How can I get the selected text in edit view? Pin
Naveen20-Apr-06 18:56
Naveen20-Apr-06 18:56 
AnswerRe: How can I get the selected text in edit view? Pin
ablaye20-Apr-06 19:11
ablaye20-Apr-06 19:11 
AnswerRe: How can I get the selected text in edit view? Pin
John R. Shaw20-Apr-06 22:02
John R. Shaw20-Apr-06 22:02 
Question【CPropertyPageEx in Vista】 Pin
chenxiujie20-Apr-06 17:42
chenxiujie20-Apr-06 17:42 
QuestionNetwork Transfer Question Pin
RedDragon2k20-Apr-06 17:30
RedDragon2k20-Apr-06 17:30 
QuestionProject Creation Favor(If someone has extra time) Pin
Expert Coming20-Apr-06 13:33
Expert Coming20-Apr-06 13:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.