-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbutton2.cpp
More file actions
41 lines (32 loc) · 861 Bytes
/
button2.cpp
File metadata and controls
41 lines (32 loc) · 861 Bytes
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
// button2.cpp -- Inline member functions
#include <iostream>
using namespace std;
#include "action.h"
class button {
private:
int isUp;
public:
void push(int upDown) { isUp = upDown; }
int state(void) { return isUp; }
void toggle(void) { isUp = ( isUp ? 0 : 1 ); }
};
#ifdef __TEST_BUTTON
int main()
{
button myButton;
action Act;
while( Act.continues2() ) {
// myButton.push(1);
// cout << "\nButton state = " << myButton.state();
// myButton.push(0);
// cout << "\nButton state = " << myButton.state();
// for( int i = 0 ; i < 4 ; ++i ) {
myButton.toggle();
cout << "\nButton state = " << myButton.state();
// }
}
Act.results();
}
// Copyright (c) 1990 by Tom Swan. All rights reserved
// Revision 1.00 Date: 09/19/1990 Time: 07:40 am
#endif