Yurttas/PL/OOL/Cplusplus/F/02/07/02/03/n 13.cpp
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 n_13.cpp
14*/
15
16
17#include "N.h"
18
19using namespace N;
20
21#include <iostream>
22
23using namespace std;
24
25int main(int argc, char* argv[]) {
26
27 N::S s_0("Apple");
28
29 cout << "initial values after default construction-S() /" << endl;
30 cout << "s_0 : ";
31 cout << s_0.N::S::get_s() << endl;
32 cout << endl;
33
34 N::S s_1("Orange");
35
36 cout << "initial values after default construction-S() /" << endl;
37 cout << "s_1 : ";
38 cout << s_1.N::S::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.N::S::get_s() << endl;
47 cout << endl;
48
49 cout << "after s_1=s_0 /" << endl;
50 cout << "s_0 : ";
51 cout << s_0.S::get_s() << endl;
52 cout << endl;
53
54 SS ss_0("Mango");
55
56 cout << "initial values after default construction-SS() /" << endl;
57 cout << "ss_0 : ";
58 cout << ss_0.N::SS::get_s() << endl;
59 cout << endl;
60
61 SS ss_1("Kiwi");
62
63 cout << "initial values after default construction-SS() /" << endl;
64 cout << "ss_1 : ";
65 cout << ss_1.SS::get_s() << endl;
66 cout << endl;
67
68 ss_1 = ss_0; // C++ provides = as memberwise assignment(default)
69 // actually, bitwise copy of ss_0.s to ss_1.s
70
71 cout << "after ss_1=ss_0 /" << endl;
72 cout << "ss_1 : ";
73 cout << ss_1.SS::get_s() << endl;
74 cout << endl;
75
76 cout << "after ss_1=ss_0 /" << endl;
77 cout << "ss_0 : ";
78 cout << ss_0.SS::get_s() << endl;
79 cout << endl;
80
81}