Yurttas/PL/OOL/Cplusplus/F/03/01/04/00/B.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   B.cpp
14*/
15
16
17#include "B.h"
18
19B::
20B(const int i) : a1(A(i)) {
21}
22
23B::
24B(const B& a) {
25  a1 = a.a1;
26}
27
28B&
29B::
30operator=(const B& a) {
31  a1 = a.a1;
32}
33
34int
35B::
36get_k() const {
37  return a1.get_k();
38}
39
40A
41B::
42get_A() const {
43  return a1;
44}
45
46void
47B::
48set_A(const A& a) {
49  a1 = a;
50}
51
52void
53B::
54set_A(const int a) {
55  a1.set_k(a);
56}
57
58ostream&
59operator<<(ostream& os,
60           const B& a) {
61  os << endl;
62  os << a.get_k(); // or: os << a.a1.get_k();
63  os << endl;
64
65  return os;
66}