-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.cpp
47 lines (34 loc) · 794 Bytes
/
test.cpp
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
#include <iostream>
using namespace std;
int main(int argc, char *argv[]) {
return 0;
}
///\invariant height_greater_zero: height > 0
///\invariant width_greater_zero: width > 0
class Rectangle {
int width, height;
public:
///\pre a_not_zero: a != 0
///\post b_not_zero: b != 0
void setEdges (int a, int b) {
this->width = a;
this->height = b;
}
///\pre c_less_d: c < d
///\post d_less_c: d < c
virtual int doSomething(int c, int d) {
return c * d;
}
} rect;
///\invariant some_inv: a > 0
///\invariant another_inv: a != c
class Test : public Rectangle {
int a;
int c;
public:
///\pre a_not_zero: c != 0
virtual int doSomething(int c, int d) {
int b = c * 2;
return b;
}
} test;