Yurttas/PL/OOL/Cplusplus/cpp/05/01/02/02/T A.h

From ZCubes Wiki
Jump to navigation Jump to search
 1/*
 2   Copyright(C) 2007
 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   : December 1, 2007.
11   author : Salih Yurttas.
12
13   T_A.h
14*/
15
16
17#include <iostream>
18
19using namespace std;
20
21template<class T>
22class T_A {
23public:
24  T_A();
25
26  T_A(const T_A<T>&);
27
28  T_A<T>& operator=(const T_A<T>&);
29
30  virtual ~T_A();
31
32  virtual int get_s() const;
33
34  virtual T get_d(const int) const;
35
36  virtual T* get_d() const;
37
38  virtual void set_d(const int size=0,
39                     const T value=0);
40
41  template<class U>              // this syntax changed several times
42  friend ostream& operator<<(ostream&,
43                             const T_A<U>&);
44
45protected:
46  int s;
47  T* d;
48};