File: class.cpp

package info (click to toggle)
libpulp 0.2.8-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 1,964 kB
  • sloc: ansic: 11,257; python: 1,110; sh: 881; makefile: 824; cpp: 582; asm: 124
file content (78 lines) | stat: -rw-r--r-- 936 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include <iostream>
#include <unistd.h>

class Point
{
  protected:
  int x, y;

  public:
  Point(int x, int y);

  int Get_X(void) const;
  int Get_Y(void) const;

  void Print(void);
};

class Point3D : public Point
{
  protected:
  int z;

  public:
  Point3D(int x, int y, int z);

  int Get_Z(void) const;

  void Print(void);
};

int Point::Get_X(void) const
{
  return x;
}

int Point::Get_Y(void) const
{
  return y;
}

// Will be livepatched
void Point::Print(void)
{
  std::cout << Get_X() << ' ' << Get_Y() << '\n';
}

Point::Point(int x, int y)
{
  this->x = x;
  this->y = y;
}

Point3D::Point3D(int x, int y, int z) : Point(x, y)
{
  this->z = z;
}

int Point3D::Get_Z(void) const
{
  return z;
}

// Will be livepatched
void Point3D::Print(void)
{
  std::cout << Get_X() << ' ' << Get_Y() << ' ' << Get_Z() << '\n';
}

int main(void)
{
  Point3D p(3, 4, 5);
  while (1) {
    p.Print();
    sleep(1);
  }

  return 0;
}