-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
44 lines (32 loc) · 898 Bytes
/
main.cpp
File metadata and controls
44 lines (32 loc) · 898 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
42
43
44
#include <iostream>
#include "reflection.h"
namespace refl = reflection;
class Base {};
struct BaseStruct {};
class Derived: public Base, public BaseStruct
{
std::string str = "string";
static const long long fl = 5;
void func1() { std::cout << "func1" << std::endl; }
int func2() { return 0; }
public:
Derived() = default;
Derived(const std::string& s) : str(s)
{}
static void StaticMethod(void) { std::cout << "In the static method" << std::endl; }
void SetStr(const std::string& s) { this->str = s; }
UseReflectionTrait
(
Derived,
Attributes(str, fl),
Methods(func1, func2, StaticMethod, SetStr),
Parents(Base, BaseStruct)
)
};
int main(void)
{
auto derived = Derived::GetInstance();
std::cout << Derived::Classname() << std::endl;
std::cout << Derived::Size() << std::endl;
return 0;
}