diff options
author | Marcelo Lira <marcelo.lira@openbossa.org> | 2009-08-17 19:31:37 -0300 |
---|---|---|
committer | Marcelo Lira <marcelo.lira@openbossa.org> | 2009-08-17 19:31:37 -0300 |
commit | e0c29962e6f334452f0c9db2caaf6ed18065de85 (patch) | |
tree | cee27801c196fbcacf6130ad64216af133b555dd /tests/libsample/derived.cpp |
The End Is the Beginning Is the End
Diffstat (limited to 'tests/libsample/derived.cpp')
-rw-r--r-- | tests/libsample/derived.cpp | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/tests/libsample/derived.cpp b/tests/libsample/derived.cpp new file mode 100644 index 000000000..9a86a9c94 --- /dev/null +++ b/tests/libsample/derived.cpp @@ -0,0 +1,80 @@ +#include <iostream> +#include "derived.h" + +using namespace std; + +Derived::Derived(int id) : Abstract(id) +{ + cout << __PRETTY_FUNCTION__; + show(); + cout << endl; +} + +Derived::~Derived() +{ + cout << __PRETTY_FUNCTION__; + show(); + cout << endl; +} + +Abstract* +Derived::createObject() +{ + static int id = 100; + return new Derived(id++); +} + +void +Derived::pureVirtual() +{ + cout << __PRETTY_FUNCTION__ << endl; +} + +void +Derived::unpureVirtual() +{ + cout << __PRETTY_FUNCTION__ << endl; +} + +bool +Derived::singleArgument(bool b) +{ + cout << __PRETTY_FUNCTION__ << endl; + return !b; +} + +double +Derived::defaultValue(int n) +{ + cout << __PRETTY_FUNCTION__ << "[n = 0]" << endl; + return ((double) n) + 0.1; +} + +PolymorphicFuncEnum +Derived::polymorphic(int i, int d) +{ + cout << __PRETTY_FUNCTION__ << "[i = 0, d = 0]" << endl; + return PolymorphicFunc_ii; +} + +PolymorphicFuncEnum +Derived::polymorphic(double n) +{ + cout << __PRETTY_FUNCTION__ << endl; + return PolymorphicFunc_d; +} + +Derived::OtherPolymorphicFuncEnum +Derived::otherPolymorphic(int a, int b, bool c, double d) +{ + cout << __PRETTY_FUNCTION__ << endl; + return OtherPolymorphicFunc_iibd; +} + +Derived::OtherPolymorphicFuncEnum +Derived::otherPolymorphic(int a, double b) +{ + cout << __PRETTY_FUNCTION__ << endl; + return OtherPolymorphicFunc_id; +} + |