-
-
Notifications
You must be signed in to change notification settings - Fork 220
Expand file tree
/
Copy pathNum.cpp
More file actions
32 lines (22 loc) · 575 Bytes
/
Num.cpp
File metadata and controls
32 lines (22 loc) · 575 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
// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*-
#include "rcpp_hello_world.h"
class Num{
public:
Num() : x(0.0), y(0){} ;
double getX() { return x ; }
void setX(double value){ x = value ; }
int getY() { return y ; }
private:
double x ;
int y ;
};
RCPP_MODULE(NumEx){
using namespace Rcpp ;
class_<Num>( "Num" )
.default_constructor()
// read and write property
.property( "x", &Num::getX, &Num::setX )
// read-only property
.property( "y", &Num::getY )
;
}