Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Foobar {
- public:
- Foobar() : index(this) {};
- void SetIndex(const int& value) { m_index = value; }
- const int& GetIndex() { return m_index; }
- Property<Foobar, int, &Foobar::GetIndex, &Foobar::SetIndex> index;
- private:
- int m_index;
- };
- void someTest(int& num) {
- num++;
- }
- int main()
- {
- auto myFoo = std::unique_ptr<Foobar>(new Foobar());
- myFoo->index = 5;
- std::cout << myFoo->index << std::endl;
- someTest((int)myFoo->index);
- std::cout << myFoo->index << std::endl;
- return 0;
- }
- /* Output:
- * 5
- * 6
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement