forked from aaronbloomfield/pdr
-
Notifications
You must be signed in to change notification settings - Fork 228
/
Copy pathname-contact.cpp.html
55 lines (51 loc) · 5.53 KB
/
name-contact.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<!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>name-contact.cpp</title>
</head>
<body style="background-color:white">
<pre><b><span style="color:#000080">#include</span></b> <span style="color:#FF0000"><iostream></span>
<b><span style="color:#0000FF">using</span></b> <b><span style="color:#0000FF">namespace</span></b> std<span style="color:#990000">;</span>
<b><span style="color:#0000FF">class</span></b> <span style="color:#008080">Name</span> <span style="color:#FF0000">{</span>
<b><span style="color:#0000FF">public</span></b><span style="color:#990000">:</span>
<b><span style="color:#000000">Name</span></b><span style="color:#990000">(</span><span style="color:#009900">void</span><span style="color:#990000">)</span> <span style="color:#990000">:</span> <b><span style="color:#000000">myName</span></b><span style="color:#990000">(</span><span style="color:#FF0000">""</span><span style="color:#990000">)</span> <span style="color:#FF0000">{</span> <span style="color:#FF0000">}</span>
<span style="color:#990000">~</span><b><span style="color:#000000">Name</span></b><span style="color:#990000">(</span><span style="color:#009900">void</span><span style="color:#990000">)</span> <span style="color:#FF0000">{</span> <span style="color:#FF0000">}</span>
<span style="color:#009900">void</span> <b><span style="color:#000000">SetName</span></b><span style="color:#990000">(</span><span style="color:#008080">string</span> theName<span style="color:#990000">)</span> <span style="color:#FF0000">{</span>
myName <span style="color:#990000">=</span> theName<span style="color:#990000">;</span>
<span style="color:#FF0000">}</span>
<span style="color:#009900">void</span> <b><span style="color:#000000">print</span></b><span style="color:#990000">(</span><span style="color:#009900">void</span><span style="color:#990000">)</span> <span style="color:#FF0000">{</span>
cout <span style="color:#990000"><<</span> myName <span style="color:#990000"><<</span> endl<span style="color:#990000">;</span>
<span style="color:#FF0000">}</span>
<b><span style="color:#0000FF">private</span></b><span style="color:#990000">:</span>
<span style="color:#008080">string</span> myName<span style="color:#990000">;</span>
<span style="color:#FF0000">}</span><span style="color:#990000">;</span>
<b><span style="color:#0000FF">class</span></b> <span style="color:#008080">Contact</span><span style="color:#990000">:</span> <b><span style="color:#0000FF">public</span></b> Name <span style="color:#FF0000">{</span>
<b><span style="color:#0000FF">public</span></b><span style="color:#990000">:</span>
<b><span style="color:#000000">Contact</span></b><span style="color:#990000">(</span><span style="color:#009900">void</span><span style="color:#990000">)</span> <span style="color:#FF0000">{</span>
myAddress <span style="color:#990000">=</span> <span style="color:#FF0000">""</span><span style="color:#990000">;</span>
<span style="color:#FF0000">}</span>
<span style="color:#990000">~</span><b><span style="color:#000000">Contact</span></b><span style="color:#990000">(</span><span style="color:#009900">void</span><span style="color:#990000">)</span> <span style="color:#FF0000">{</span> <span style="color:#FF0000">}</span>
<span style="color:#009900">void</span> <b><span style="color:#000000">SetAddress</span></b><span style="color:#990000">(</span><span style="color:#008080">string</span> theAddress<span style="color:#990000">)</span> <span style="color:#FF0000">{</span>
myAddress <span style="color:#990000">=</span> theAddress<span style="color:#990000">;</span>
<span style="color:#FF0000">}</span>
<span style="color:#009900">void</span> <b><span style="color:#000000">print</span></b><span style="color:#990000">(</span><span style="color:#009900">void</span><span style="color:#990000">)</span> <span style="color:#FF0000">{</span>
Name<span style="color:#990000">::</span><b><span style="color:#000000">print</span></b><span style="color:#990000">();</span>
cout <span style="color:#990000"><<</span> myAddress <span style="color:#990000"><<</span> endl<span style="color:#990000">;</span>
<span style="color:#FF0000">}</span>
<b><span style="color:#0000FF">private</span></b><span style="color:#990000">:</span>
<span style="color:#008080">string</span> myAddress<span style="color:#990000">;</span>
<span style="color:#FF0000">}</span><span style="color:#990000">;</span>
<span style="color:#009900">int</span> <b><span style="color:#000000">main</span></b><span style="color:#990000">(</span><span style="color:#009900">void</span><span style="color:#990000">)</span> <span style="color:#FF0000">{</span>
<span style="color:#008080">Contact</span> c<span style="color:#990000">;</span>
c<span style="color:#990000">.</span><b><span style="color:#000000">SetName</span></b><span style="color:#990000">(</span><span style="color:#FF0000">"John Doe"</span><span style="color:#990000">);</span>
c<span style="color:#990000">.</span><b><span style="color:#000000">SetAddress</span></b><span style="color:#990000">(</span><span style="color:#FF0000">"009 Olsson Hall"</span><span style="color:#990000">);</span>
c<span style="color:#990000">.</span><b><span style="color:#000000">print</span></b><span style="color:#990000">();</span>
<span style="color:#FF0000">}</span>
</pre>
</body>
</html>