1896
01:19:16,700 --> 01:19:19,550
那接下来我们就开始来建模了
1897
01:19:20,690 --> 01:19:22,163
那建模的开始呢
1898
01:19:22,163 --> 01:19:24,900
我们就首先要添加一个类了
1899
01:19:26,330 --> 01:19:27,868
那我们这个很简单
1900
01:19:27,868 --> 01:19:29,983
就是一个倒数的一个程序
1901
01:19:29,983 --> 01:19:33,060
我们就把这个类就叫某某系统好了
1902
01:19:33,340 --> 01:19:33,606
1903
01:19:33,606 --> 01:19:36,800
就把整个系统当作一个
1904
01:19:37,090 --> 01:19:39,220
类来画状态机
1905
01:19:39,500 --> 01:19:42,640
画在这个,它就默认给了一个
1906
01:19:43,270 --> 01:19:45,320
给了一个类图在这里
1907
01:19:45,930 --> 01:19:46,764
Model1
1908
01:19:46,764 --> 01:19:47,320
这里
1909
01:19:47,720 --> 01:19:47,880
1910
01:19:47,880 --> 01:19:49,650
那我们就画在这里就行了
1911
01:19:53,020 --> 01:19:55,075
放上一个类
1912
01:19:55,075 --> 01:19:55,760
这里
1913
01:19:57,380 --> 01:19:58,610
放上来
1914
01:19:59,440 --> 01:20:01,088
然后起名叫什么
1915
01:20:01,088 --> 01:20:02,030
起名就叫
1916
01:20:02,950 --> 01:20:03,730
1917
01:20:07,430 --> 01:20:10,301
那个名字我们就叫
1918
01:20:10,301 --> 01:20:12,510
就按照那个名字来
1919
01:20:12,800 --> 01:20:13,810
CountDown
1920
01:20:17,190 --> 01:20:18,110
1921
01:20:19,480 --> 01:20:22,070
这后面加一个System,系统
1922
01:20:22,350 --> 01:20:22,552
1923
01:20:22,552 --> 01:20:23,360
就这样
1924
01:20:27,550 --> 01:20:28,600
这样来
1925
01:20:30,260 --> 01:20:31,250
然后确定
1926
01:20:33,380 --> 01:20:34,190
好
1927
01:20:34,540 --> 01:20:36,420
把它放大一点
1928
01:20:36,950 --> 01:20:38,160
1929
01:20:39,260 --> 01:20:41,033
字体可以设置的
1930
01:20:41,033 --> 01:20:42,485
我们这里就不设置了
1931
01:20:42,485 --> 01:20:43,130
就这样
1932
01:20:45,740 --> 01:20:46,655
然后呢
1933
01:20:46,655 --> 01:20:50,930
接下来,我们就首先给它添加一个
1934
01:20:51,980 --> 01:20:53,220
构造器
1935
01:20:56,860 --> 01:20:58,921
就是如何生成对象
1936
01:20:58,921 --> 01:21:01,240
要定义一个构造器
1937
01:21:02,700 --> 01:21:04,169
那怎么加
1938
01:21:04,169 --> 01:21:06,520
我们右键点这个类
1939
01:21:07,540 --> 01:21:11,866
然后这里,新增这里,新增这里,构造函数
1940
01:21:11,866 --> 01:21:12,630
这里
1941
01:21:13,120 --> 01:21:14,136
如果是英文
1942
01:21:14,136 --> 01:21:15,407
就是constructor
1943
01:21:15,407 --> 01:21:17,440
就是构造函数
1944
01:21:22,530 --> 01:21:24,580
那就出来这样一个框
1945
01:21:25,790 --> 01:21:26,361
然后呢
1946
01:21:26,361 --> 01:21:27,885
出来这个框以后
1947
01:21:27,885 --> 01:21:29,980
我们就直接点OK就行了
1948
01:21:30,260 --> 01:21:30,446
1949
01:21:30,446 --> 01:21:31,940
直接点OK就行了
1950
01:21:34,350 --> 01:21:36,970
因为我们不需要加什么参数嘛
1951
01:21:37,250 --> 01:21:38,838
这里如果有参数要加
1952
01:21:38,838 --> 01:21:40,250
就可以在这里加
1953
01:21:40,250 --> 01:21:42,720
这里我们就不用加什么参数
1954
01:21:42,720 --> 01:21:43,250
直接就
1955
01:21:43,970 --> 01:21:44,770
确定
1956
01:21:45,610 --> 01:21:45,904
好
1957
01:21:45,904 --> 01:21:47,670
就得到了一个
1958
01:21:48,950 --> 01:21:51,183
这样的一个操作
1959
01:21:51,183 --> 01:21:52,140
对不对
1960
01:21:54,550 --> 01:21:55,790
然后我们
1961
01:21:56,070 --> 01:21:57,860
双击这个操作
1962
01:21:58,730 --> 01:22:00,075
这个操作
1963
01:22:00,075 --> 01:22:02,190
跟这个类的名字是一样的
1964
01:22:02,680 --> 01:22:02,877
1965
01:22:02,877 --> 01:22:04,650
那我们双击这个操作
1966
01:22:11,540 --> 01:22:12,136
然后呢
1967
01:22:12,136 --> 01:22:13,726
它有很多页签
1968
01:22:13,726 --> 01:22:16,310
我们在实现的页签
1969
01:22:16,310 --> 01:22:17,900
实现页签这里
1970
01:22:18,300 --> 01:22:19,750
来编写
1971
01:22:21,940 --> 01:22:23,510
这个构造器
1972
01:22:23,940 --> 01:22:26,230
里面的实现的代码
1973
01:22:27,130 --> 01:22:27,334
1974
01:22:27,334 --> 01:22:28,762
那我们就简单点
1975
01:22:28,762 --> 01:22:30,190
那这里的话,它是
1976
01:22:31,270 --> 01:22:34,090
缺省是用C++
1977
01:22:36,710 --> 01:22:38,656
来作为实现的语言
1978
01:22:38,656 --> 01:22:40,602
这个也可以设置的
1979
01:22:40,602 --> 01:22:42,980
但是我们这个默认的就是
1980
01:22:42,980 --> 01:22:45,791
你看这个上面写的C++嘛
1981
01:22:45,791 --> 01:22:46,440
对吧。你也可以配置改成C
1982
01:22:48,010 --> 01:22:55,770
C、C++、Java,还有另外一个是Ada
1983
01:22:56,910 --> 01:22:58,780
主要是这四个语言
1984
01:22:59,180 --> 01:23:00,270
它是
1985
01:23:00,550 --> 01:23:05,170
直接在那个工具里面支持的,那其他语言的话
1986
01:23:05,450 --> 01:23:08,131
应该也有类似插件的
1987
01:23:08,131 --> 01:23:11,110
但是我一般就是
1988
01:23:11,390 --> 01:23:13,850
用这个C/C++这个就可以了
1989
01:23:14,130 --> 01:23:16,530
作为演示,这个就够了
1990
01:23:18,360 --> 01:23:22,310
然后这里写std
1991
01:23:22,960 --> 01:23:23,590
1992
01:23:24,170 --> 01:23:25,510
cout
1993
01:23:28,160 --> 01:23:28,990
然后
1994
01:23:33,560 --> 01:23:34,620
Hello
1995
01:23:35,840 --> 01:23:37,410
然后是
1996
01:23:39,230 --> 01:23:39,650
1997
01:23:39,650 --> 01:23:40,490
1998
01:23:40,950 --> 01:23:41,530
1999
01:23:52,780 --> 01:23:53,600
2000
01:23:53,930 --> 01:23:55,098
实际上
2001
01:23:55,098 --> 01:23:58,310
就是输出一个Hello这样一个
2002
01:23:58,680 --> 01:23:59,650
字符串
2003
01:24:00,790 --> 01:24:05,570
那前面这个std就是一个命名空间了
2004
01:24:06,030 --> 01:24:12,620
因为我们没有用类似什么using
2005
01:24:12,900 --> 01:24:15,210
namespace什么什么什么这种
2006
01:24:18,160 --> 01:24:18,348
2007
01:24:18,348 --> 01:24:21,170
什么std这样的,没有用这样
2008
01:24:21,910 --> 01:24:23,870
如果前面有这个的话
2009
01:24:25,410 --> 01:24:26,994
那么就不用加这个
2010
01:24:26,994 --> 01:24:28,579
我们现在就简单点
2011
01:24:28,579 --> 01:24:30,560
直接就前面加一个
2012
01:24:30,990 --> 01:24:32,316
命名空间
2013
01:24:32,316 --> 01:24:32,980
然后
2014
01:24:33,630 --> 01:24:37,986
后面加一个作用域的一个符号
2015
01:24:37,986 --> 01:24:40,710
就是std的cout这个
2016
01:24:41,970 --> 01:24:44,070
这个
2017
01:24:44,380 --> 01:24:44,766
2018
01:24:44,766 --> 01:24:45,540
函数
2019
01:24:47,660 --> 01:24:48,630
这样来
2020
01:24:50,010 --> 01:24:54,180
那么这个地方就输这么一行
2021
01:24:57,110 --> 01:24:58,100
然后呢
2022
01:24:58,470 --> 01:25:00,131
我们还要再设置
2023
01:25:00,131 --> 01:25:02,000
在这个属性这里
2024
01:25:02,910 --> 01:25:04,268
这个页签这里
2025
01:25:04,268 --> 01:25:06,597
同样这里也有很多很多
2026
01:25:06,597 --> 01:25:08,150
我们同样查看全部
2027
01:25:08,880 --> 01:25:09,740
然后呢
2028
01:25:09,740 --> 01:25:10,600
在这个
2029
01:25:12,780 --> 01:25:15,355
cpp,就C++嘛
2030
01:25:15,355 --> 01:25:17,930
C++的这个配置这里
2031
01:25:18,450 --> 01:25:20,940
然后,Class这里
2032
01:25:23,770 --> 01:25:25,896
然后我们这里有很多很多
2033
01:25:25,896 --> 01:25:27,250
我们在这个地方
2034
01:25:30,040 --> 01:25:36,230
这个Imp就是实现的意思
2035
01:25:36,510 --> 01:25:37,587
实现的Include
2036
01:25:37,587 --> 01:25:41,898
相当于程序开头那个include什么什么
2037
01:25:41,898 --> 01:25:44,270
那我们这里include是那个
2038
01:25:45,210 --> 01:25:47,750
iostream这个库
2039
01:25:48,030 --> 01:25:50,968
就是输入输出的那个标准库嘛
2040
01:25:50,968 --> 01:25:51,360
对吧
2041
01:25:52,310 --> 01:25:54,040
那我们这里就写
2042
01:25:58,350 --> 01:25:59,490
<iostream>
2043
01:26:03,660 --> 01:26:04,400
2044
01:26:05,710 --> 01:26:06,870
2045
01:26:08,800 --> 01:26:10,860
然后这里就确定了
2046
01:26:15,270 --> 01:26:16,140
好
2047
01:26:17,810 --> 01:26:21,360
这是定义它的构造器了
2048
01:26:23,110 --> 01:26:25,955
接下来呢我们就要设置一个组件了
2049
01:26:25,955 --> 01:26:27,852
那组件在这个包下面
2050
01:26:27,852 --> 01:26:31,456
这里已经给出了一个,主动加了一个组件
2051
01:26:31,456 --> 01:26:32,025
当然了
2052
01:26:32,025 --> 01:26:33,542
名字叫缺省组件
2053
01:26:33,542 --> 01:26:34,870
我们不能这么叫
2054
01:26:34,870 --> 01:26:36,577
我们改一个名字
2055
01:26:36,577 --> 01:26:38,664
我们就直接用这个就行了
2056
01:26:38,664 --> 01:26:38,854
2057
01:26:38,854 --> 01:26:40,371
改个名字怎么改
2058
01:26:40,371 --> 01:26:41,320
就双击这个
2059
01:26:41,870 --> 01:26:42,420
2060
01:26:43,650 --> 01:26:46,902
它名字不是叫default什么什么的
2061
01:26:46,902 --> 01:26:49,006
我们就不要这样叫了
2062
01:26:49,006 --> 01:26:50,537
我们直接就叫
2063
01:26:50,537 --> 01:26:50,920
2064
01:26:51,200 --> 01:26:51,960
Test
2065
01:26:52,250 --> 01:26:53,530
测试
2066
01:26:53,810 --> 01:26:56,019
然后再看类型这里
2067
01:26:56,019 --> 01:26:57,400
它有几个
2068
01:26:57,790 --> 01:26:57,986
2069
01:26:57,986 --> 01:27:00,142
库,类似DLL一样
2070
01:27:00,142 --> 01:27:00,730
这个是
2071
01:27:01,010 --> 01:27:03,504
可执行文件,就exe文件嘛
2072
01:27:03,504 --> 01:27:06,190
这个已经是这个了
2073
01:27:06,560 --> 01:27:08,502
已经是这个可执行文件
2074
01:27:08,502 --> 01:27:09,796
那就不用管了
2075
01:27:09,796 --> 01:27:10,660
其它的就
2076
01:27:11,170 --> 01:27:12,400
不用管
2077
01:27:12,760 --> 01:27:12,945
2078
01:27:12,945 --> 01:27:14,430
然后就确定就行了
2079
01:27:15,540 --> 01:27:15,739
2080
01:27:15,739 --> 01:27:17,132
点应用也可以
2081
01:27:17,132 --> 01:27:17,730
点应用
2082
01:27:18,010 --> 01:27:20,350
因为还要再配其它的
2083
01:27:20,350 --> 01:27:22,105
所以应用,先不要关
2084
01:27:22,105 --> 01:27:22,690
点应用
2085
01:27:25,790 --> 01:27:26,401
然后呢
2086
01:27:26,401 --> 01:27:28,236
这个框是没有关掉
2087
01:27:28,236 --> 01:27:29,052
没有关掉
2088
01:27:29,052 --> 01:27:30,887
它不影响后面的操作
2089
01:27:30,887 --> 01:27:32,314
你后面还可以点
2090
01:27:32,314 --> 01:27:32,722
对吧
2091
01:27:32,722 --> 01:27:34,150
你后面还可以点
2092
01:27:35,030 --> 01:27:36,730
所以呢,这个属性框
2093
01:27:36,730 --> 01:27:38,620
它是随着这边点来定
2094
01:27:38,620 --> 01:27:39,754
你看,点这里
2095
01:27:39,754 --> 01:27:41,266
它就跳,变这里
2096
01:27:41,266 --> 01:27:42,400
所以这个框
2097
01:27:42,690 --> 01:27:43,153
2098
01:27:43,153 --> 01:27:44,080
不用
2099
01:27:45,230 --> 01:27:46,374
不用着急关掉