Yurttas/PL/OOL/Cplusplus/F/03/02/01/00/05/s 03.cpp

From ZCubes Wiki
Jump to navigation Jump to search
 1/*
 2   Copyright(C) 1998
 3   All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc..
 4
 5   Permission to use, copy, modify, and distribute this
 6   software and its documentation for EDUCATIONAL purposes
 7   and without fee is hereby granted provided that this
 8   copyright notice appears in all copies.
 9
10   date   : January 1, 1998.
11   author : Salih Yurttas.
12
13   s_03.cpp
14*/
15
16
17#include <iostream>
18
19using namespace std;
20
21#include "S.h"
22
23extern void f_00(S);
24
25int main(int argc, char* argv[]) {
26
27  S s_0("Apple");
28
29  cout << "initial values after default construction-S() /" << endl;
30  cout << "s_0 : ";
31  cout << s_0 << endl;
32  cout << endl;
33
34  f_00(s_0); // call by-value
35
36  S s_1;
37
38  s_1 = s_0;
39
40  cout << "after s_1=s_0 /" << endl;
41  cout << "s_1 : ";
42  cout << s_1 << endl;
43  cout << endl;
44
45  cout << "after s_1=s_0 /" << endl;
46  cout << "s_0 : ";
47  cout << s_0 << endl;
48  cout << endl;
49
50  if(s_1==s_0) cout << "==" << endl;
51  else cout << "!=" << endl;
52
53  S s_2("Orange");
54
55  if(s_2==s_1) cout << "==" << endl;
56  else cout << "!=" << endl;
57
58}