Skip to content

Instantly share code, notes, and snippets.

@sh1boot
Last active August 29, 2015 14:21
Show Gist options
  • Save sh1boot/b175d1c70039990c236b to your computer and use it in GitHub Desktop.
Save sh1boot/b175d1c70039990c236b to your computer and use it in GitHub Desktop.
#include <stdint.h>
class Foo {
uint64_t& data;
uint64_t* const pdata;
public:
Foo(uint64_t& d) : data(d), pdata(&d) { }
inline uint64_t get(void) { return data; }
inline uint64_t pget(void) { return *pdata; }
};
class Bar : public Foo {
uint64_t mine;
public:
Bar(void) : Foo(mine) { }
uint64_t getget(void) { return get(); }
uint64_t pgetget(void) { return pget(); }
uint64_t justget(void) { return mine; }
};
uint32_t fn(Bar &b) {
return b.getget();
}
uint32_t pfn(Bar &b) {
return b.pgetget();
}
uint32_t fn1(Bar &b) {
return b.justget();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment