我一直在使用C++嵌入Lua脚本的经验,我可以在这里使用.
考虑以下两个类:
// Person.hpp
#pragma once
#include <string>
class Person {
private:
std::string p_Name;
int p_Age;
public:
Person(const std::string & strName, const int & intAge)
: p_Name(strName), p_Age(intAge) { }
Person() : p_Name(""), p_Age(0) { }
std::string getName() const { return p_Name; }
int getAge() const { return p_Age; }
void setName(const std::string & strName) { p_Name = strName; }
void setAge(const int & intAge) { p_Age = intAge; }
};
Run Code Online (Sandbox Code Playgroud)
......而且......
// PersonManager.hpp
#pragma once
#include "Person.hpp"
#include <vector> …Run Code Online (Sandbox Code Playgroud)