forked from aaronbloomfield/pdr
-
Notifications
You must be signed in to change notification settings - Fork 228
/
IntCell.cpp.html
34 lines (28 loc) · 2.65 KB
/
IntCell.cpp.html
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
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="GNU source-highlight
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite">
<title>IntCell.cpp</title>
</head>
<body style="background-color:white">
<pre><i><span style="color:#9A1900">// File IntCell.cpp</span></i>
<b><span style="color:#000080">#include</span></b> <span style="color:#FF0000">"IntCell.h"</span>
<b><span style="color:#0000FF">using</span></b> <b><span style="color:#0000FF">namespace</span></b> std<span style="color:#990000">;</span> <i><span style="color:#9A1900">// (not really necessary, but...)</span></i>
IntCell<span style="color:#990000">::</span><b><span style="color:#000000">IntCell</span></b><span style="color:#990000">(</span> <span style="color:#009900">int</span> initialValue <span style="color:#990000">)</span> <span style="color:#990000">:</span> <b><span style="color:#000000">storedValue</span></b><span style="color:#990000">(</span> initialValue <span style="color:#990000">)</span> <span style="color:#FF0000">{</span>
<span style="color:#FF0000">}</span>
<span style="color:#009900">int</span> IntCell<span style="color:#990000">::</span><b><span style="color:#000000">getValue</span></b><span style="color:#990000">(</span> <span style="color:#990000">)</span> <b><span style="color:#0000FF">const</span></b> <span style="color:#FF0000">{</span>
<b><span style="color:#0000FF">return</span></b> storedValue<span style="color:#990000">;</span>
<span style="color:#FF0000">}</span>
<span style="color:#009900">void</span> IntCell<span style="color:#990000">::</span><b><span style="color:#000000">setValue</span></b><span style="color:#990000">(</span> <span style="color:#009900">int</span> val <span style="color:#990000">)</span> <span style="color:#FF0000">{</span>
storedValue <span style="color:#990000">=</span> val<span style="color:#990000">;</span>
<span style="color:#FF0000">}</span>
<span style="color:#009900">int</span> IntCell<span style="color:#990000">::</span><b><span style="color:#000000">max</span></b><span style="color:#990000">(</span><span style="color:#009900">int</span> m<span style="color:#990000">)</span> <b><span style="color:#0000FF">const</span></b> <span style="color:#FF0000">{</span>
<b><span style="color:#0000FF">return</span></b> <span style="color:#990000">(</span>m<span style="color:#990000">></span>storedValue<span style="color:#990000">)</span> <span style="color:#990000">?</span> m <span style="color:#990000">:</span> storedValue<span style="color:#990000">;</span>
<span style="color:#FF0000">}</span>
</pre>
</body>
</html>