Yurttas/PL/OOL/Cplusplus/F/02/07/03/00/a 00.cpp

From ZCubes Wiki
Jump to navigation Jump to search
 1/*
 2   Copyright(C) 2000
 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, 2000.
11   author : Salih Yurttas.
12
13   a_00.cpp
14*/
15
16
17#include <iostream>
18
19using namespace std;
20
21#include "A.h"
22
23using namespace A;
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.get_s() << endl;
32  cout << endl;
33
34  S s_1("Orange");
35
36  cout << "initial values after default construction-S() /" << endl;
37  cout << "s_1 :";
38  cout << s_1.get_s() << endl;
39  cout << endl;
40
41  s_1 = s_0; // C++ provides = as memberwise assignment(default)
42             // actually, bitwise copy of s_0.s to s_1.s
43
44  cout << "after s_1=s_0 /" << endl;
45  cout << "s_1 :";
46  cout << s_1.get_s() << endl;
47  cout << endl;
48
49  cout << "after s_1=s_0 /" << endl;
50  cout << "s_0 :";
51  cout << s_0.get_s() << endl;
52  cout << endl;
53
54  f_a(5);
55
56  f_b(2);
57
58}