⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 example5.cc

📁 cpptcl library for ns2
💻 CC
字号:
// example5.cc#include "cpptcl.h"#include <string>using namespace std;using namespace Tcl;class Person{public:     Person(string const &n) : name(n) {}     void setName(string const &n) { name = n; }     string getName() { return name; }private:     string name;};// this is a factory functionPerson * makePerson(string const &name){     return new Person(name);}// this is a sink functionvoid killPerson(Person *p){     delete p;}CPPTCL_MODULE(Mymodule, i){     // note that the Person class is exposed without any constructor     i.class_<Person>("Person", no_init)          .def("setName", &Person::setName)          .def("getName", &Person::getName);     i.def("makePerson", makePerson, factory("Person"));     i.def("killPerson", killPerson, sink(1));}

⌨️ 快捷键说明

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