Qt演示单继承传递参数
1 #include "mainwindow.h"
2 #include <QApplication>
3 #include<Windows.h>
4
5 class ye
6 {
7 public:
8 ye(int a,int b):x(a),y(b)
9 {
10 p= new MainWindow;
11 p->resize(this->x,this->y);
12 p->show();
13 }
14 ~ye()
15 {
16 delete p;
17 }
18
19 public:
20 MainWindow *p;
21 int x;
22 int y;//宽度与长度
23 };
24
25 class die:public ye
26 {
27 public:
28 die(int a,int b,int c,int d):ye(a,b),cx(c),cy(d)
29 {
30 this->p->move(cx,cy);
31 }
32 ~die()
33 {
34
35 }
36
37 public:
38 int cx;
39 int cy;//位置,x,y坐标
40 };
41
42 class er:public die
43 {
44 public:
45 er(int a,int b, int c,int d, int e):die(a,b,c,d),size(e)
46 {
47 for(int i=0;i<size;i++)
48 {
49 this->p->resize((this->x)*(i+1),(this->y)*(i+1));
50 Sleep(1000);
51 }
52 }
53
54 public:
55 int size;
56 };
57
58 int main(int argc, char *argv[])
59 {
60 QApplication a(argc, argv);
61 er *p =new er(100,100,0,0,8);
62
63 return a.exec();
64 }
长风破浪会有时,直挂云帆济沧海
posted on 2015-06-09 08:43 Dragon-wuxl 阅读(235) 评论(0) 收藏 举报
浙公网安备 33010602011771号