⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 page_956.html

📁 Programming and Problem Solving with C++
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">	<html>		<head>			<title>page_956</title>			<link rel="stylesheet" href="reset.css" type="text/css" media="all">			<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />		</head>		<body>		<table summary="top nav" border="0" width="100%">			<tr>				<td align="left" width="30%" style="background: #EEF3E2"><a style="color: blue; font-size: 120%; font-weight: bold; text-decoration: none; font-family: verdana;" href="page_955.html">&lt;&nbsp;previous page</a></td>				<td align="center" width="40%" style="background: #EEF3E2"><strong style="color: #2F4F4F; font-size: 120%;">page_956</strong></td>				<td align="right" width="30%" style="background: #EEF3E2"><a style="color: blue; font-size: 120%; font-weight: bold; text-decoration: none; font-family: verdana;" href="page_957.html">next page&nbsp;&gt;</a></td>			</tr>					<tr>				<td align="left" colspan="3" style="background: #ffffff; padding: 20px;">    <table border="0" width="100%" cellpadding="0"><tr><td align="center">  <table border="0" cellpadding="2" cellspacing="0" width="100%"><tr><td align="left"></td>  <td align="right"></td>  </tr></table></td></tr><tr><td align="left"><p></p><table border="0" cellspacing="0" cellpadding="0" width="100%"><tr><td align="right"><font face="Times New Roman, Times, Serif" size="2" color="#FF0000">Page 956</font></td></tr></table><table border="0" cellspacing="0" cellpadding="0"><tr><td rowspan="5"></td>  <td colspan="3" height="12"></td>  <td rowspan="5"></td></tr><tr><td colspan="3"></td></tr><tr><td></td>  <td><font face="Courier New, Courier, Mono New, Courier, Mono" size="2">Enter聽an聽employee聽ID聽(negative聽to聽quit):聽398405<br />ID:聽398405聽Time:聽07:45:04<br /><br />Enter聽an聽employee聽ID聽(negative聽to聽quit):聽193847<br />ID:聽193847聽Time:聽07:53:20<br /><br />Enter聽an聽employee聽ID聽(negative聽to聽quit):聽290387<br />ID:聽290387聽Time:聽07:48:10<br /><br />Enter聽an聽employee聽ID聽(negative聽to聽quit):聽938473<br />938473聽has聽not聽punched聽in聽yet.<br /><br />Enter聽an聽employee聽ID聽(negative聽to聽quit):聽111111<br />111111聽has聽not聽punched聽in聽yet.<br /><br />Enter聽an聽employee聽ID聽(negative聽to聽quit):聽-5</font></td><td></td></tr><tr><td colspan="3"></td></tr><tr><td colspan="3" height="1"></td></tr></table><table border="0" cellspacing="0" cellpadding="0"><tr><td rowspan="5"></td>  <td colspan="3" height="12"></td>  <td rowspan="5"></td></tr><tr><td colspan="3"></td></tr><tr><td></td>  <td><font face="Times New Roman, Times, Serif" size="3">After testing this aspect of the program, we must not forget to change the value of </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">MAX_LENGTH</font><font face="Times New Roman, Times, Serif" size="3"> back to 500, recompile </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">tclist.cpp</font><font face="Times New Roman, Times, Serif" size="3">, and relink the object code files.</font></td><td></td></tr><tr><td colspan="3"></td></tr><tr><td colspan="3" height="1"></td></tr></table><table border="0" cellspacing="0" cellpadding="0"><tr><td rowspan="5"></td>  <td colspan="3" height="17"></td>  <td rowspan="5"></td></tr><tr><td colspan="3"></td></tr><tr><td></td>  <td><font face="Times New Roman, Times, Serif" size="3">Testing and Debugging</font></td><td></td></tr><tr><td colspan="3"></td></tr><tr><td colspan="3" height="1"></td></tr></table><table border="0" cellspacing="0" cellpadding="0"><tr><td rowspan="5"></td>  <td colspan="3" height="12"></td>  <td rowspan="5"></td></tr><tr><td colspan="3"></td></tr><tr><td></td>  <td><font face="Times New Roman, Times, Serif" size="3">Testing and debugging an object-oriented program is largely a process of testing and debugging the C++ classes on which the program is built. The top-level driver also needs testing, but this testing is usually uncomplicatedOOD tends to result in a simple driver.</font></td><td></td></tr><tr><td colspan="3"></td></tr><tr><td colspan="3" height="1"></td></tr></table><table border="0" cellspacing="0" cellpadding="0"><tr><td rowspan="5"></td>  <td colspan="3" height="12"></td>  <td rowspan="5"></td></tr><tr><td colspan="3"></td></tr><tr><td></td>  <td><font face="Times New Roman, Times, Serif" size="3">To review how to test a C++ class, you should refer back to the Testing and Debugging section of Chapter 15. There we walked through the process of testing each member function of a class. We made the observation that you could write a separate test driver for each member function or you could write just one test driver that tests all of the member functions. The latter approach is recommended only for classes that have a few simple member functions.</font></td><td></td></tr><tr><td colspan="3"></td></tr><tr><td colspan="3" height="1"></td></tr></table><table border="0" cellspacing="0" cellpadding="0"><tr><td rowspan="5"></td>  <td colspan="3" height="12"></td>  <td rowspan="5"></td></tr><tr><td colspan="3"></td></tr><tr><td></td>  <td><font face="Times New Roman, Times, Serif" size="3">When an object-oriented program uses inheritance and composition, the order in which you test the classes is, in a sense, predetermined. If class <i>X</i> is derived from class <i>Y</i>or contains an object of class <i>Y,</i> you cannot test <i>X</i> until you have designed and implemented <i>Y.</i> Thus, it makes sense to test and debug the lower level class (class <i>Y)</i> before testing class <i>X.</i> This chapter's Problem-Solving Case Study demonstrated this sequence of testing. We tested the lowest level classthe </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">Time</font><font face="Times New Roman, Times, Serif" size="3"> classfirst. Next, we tested the </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">TimeCard</font><font face="Times New Roman, Times, Serif" size="3"> class, which contains a </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">Time</font><font face="Times New Roman, Times, Serif" size="3"> object. Finally, we tested the </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">TimeCardList</font><font face="Times New Roman, Times, Serif" size="3"> class, which contains an array of </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">TimeCard</font><font face="Times New Roman, Times, Serif" size="3"> objects. The general principle is that if class <i>X</i> is built on class <i>Y</i> (through inheritance or composition), the testing of <i>X</i> is simplified if <i>Y</i> is already tested and is known to behave correctly.</font></td><td></td></tr><tr><td colspan="3"></td></tr><tr><td colspan="3" height="1"></td></tr></table></td></tr></table><p><font size="0"></font></p>  </td>			</tr>				<tr>				<td align="left" width="30%" style="background: #EEF3E2"><a style="color: blue; font-size: 120%; font-weight: bold; text-decoration: none; font-family: verdana;" href="page_955.html">&lt;&nbsp;previous page</a></td>				<td align="center" width="40%" style="background: #EEF3E2"><strong style="color: #2F4F4F; font-size: 120%;">page_956</strong></td>				<td align="right" width="30%" style="background: #EEF3E2"><a style="color: blue; font-size: 120%; font-weight: bold; text-decoration: none; font-family: verdana;" href="page_957.html">next page&nbsp;&gt;</a></td>			</tr>		</table>		</body>	</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -