hi everyone,
I have 2 nested class (nest_1,nest_2).1st class is inherited by 2nd class and i want to access member of 1st nested class in a function of 2nd class.
I tried like...
.h file
{
Q_OBJECT
public:
explicit MainWindow
(QWidget *parent
= 0);
~MainWindow();
int main_data;
private:
Ui::MainWindow *ui;
public:
class nest_1
{
public:
int data1;
};
class nest_2 : public nest_1
{
public:
int data2;
int test();
};
};
class A : public MainWindow
{
public:
int data;
int test();
};
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
int main_data;
private:
Ui::MainWindow *ui;
public:
class nest_1
{
public:
int data1;
};
class nest_2 : public nest_1
{
public:
int data2;
int test();
};
};
class A : public MainWindow
{
public:
int data;
int test();
};
To copy to clipboard, switch view to plain text mode
.cpp file
int MainWindow::nest_2::test()
{
// here i want to access data1
}
int A::test()
{
main_data = 0; //here i am able to access main_data
}
int MainWindow::nest_2::test()
{
// here i want to access data1
}
int A::test()
{
main_data = 0; //here i am able to access main_data
}
To copy to clipboard, switch view to plain text mode
I tried same thing for MainWindow and A.It is working.But for nested class it is not.
Can any one tell me how to access it or any error in my code ?
with regards
bibhu.
Bookmarks