Problem of visibility in static access to a methods

this is my file wwin.h

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#ifndef WWIN_H
#define WWIN_H

#include <string>

#include <QMessageBox>

namespace Wwin {


class Windows
{
public:
    Windows();
    static string Windows::Msg_YesNo(string,string);
    static string Windows::Msg_YesNoCancel(string,string);
private:
    string MsgGenericYesNoCancel(string,string,QMessageBox::StandardButton);

};

#endif // WWINU_H

}



and this one wwin.cpp

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include "wwin.h"
#include <QMessageBox>
#include <string>


Wwin::Windows()
{
}

string Wwin::Windows::MsgGenericYesNoCancel(string title,string msg,QMessageBox::StandardButton tipo_yesnocancel)
{
string resp;
QMessageBox::StandardButton reply;

//QApplication::focusWidget ()

reply = QMessageBox::question(this, tr(title), tr(msg),tipo_yesnocancel);
if (reply == QMessageBox::Yes)
    resp="yes";
else if (reply == QMessageBox::No)
        resp="no";
else
   questionLabel->setText(tr("Cancel"));  resp="cancel";

return resp;
}




string Wwin::Windows::Msg_YesNo(string title,string msg)
{
    return Wwin::Windows::wwMsgGenericYesnoCancel(title,msg,QMessageBox::Yes | QMessageBox::No);
}

string Wwin::Windows::Message_YesNoCancel(string title,string msg)
{
return  Wwin::Windows::MsgGenericYesnoCancel(title,msg,QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
}


Then I want to use this functions via #include wwin.h
I dont know what happen, but in my IDE when I write
Wwin:: it offers me Windows, OK
Then if i write Wwin::Windows:: it offers me only the private MsgGenericYesnoCancel and not the public static Message_YesNoCancel or Message_YesNo

But is you see I have an error ( I think) . I must to write :
string Windows::MsgGenericYesNoCancel
But in that case, Wwin::Windows:: offers me notthing!


Why it is happen ?
Thanks
Last edited on
I think that the problem is to write Win::Windows:: into the body of the class.
All is solved if I write Msg_YesNo only:
Delete this post
Topic archived. No new replies allowed.