example3.cc

来自「cpptcl library for ns2」· CC 代码 · 共 32 行

CC
32
字号
// example3.cc#include "cpptcl.h"#include <string>using namespace std;using namespace Tcl;class Person{public:     void setName(string const &n) { name = n; }     string getName() { return name; }private:     string name;};CPPTCL_MODULE(Mymodule, i){     i.class_<Person>("Person")          .def("setName", &Person::setName)          .def("getName", &Person::getName);     // or, alternatively:     //i.class_<Person>("Person", init<>())     //     .def("setName", &Person::setName)     //     .def("getName", &Person::getName);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?