Commit 9b84300e authored by Joe Snyder's avatar Joe Snyder
Browse files

Merge branch 'constructor_args' into 'master'

Add default arguments to constructor

Closes #145

See merge request autopybind11/autopybind11!107
parents 8f76d597 4c18f450
...@@ -4,6 +4,10 @@ ...@@ -4,6 +4,10 @@
simple::simple() simple::simple()
{ {
} }
simple::simple(int var1, int optional)
{
std::cout << optional << "\n";
}
int simple::hello() int simple::hello()
{ {
......
...@@ -4,6 +4,7 @@ class simple ...@@ -4,6 +4,7 @@ class simple
{ {
public: public:
simple(); simple();
simple(int var1, int optional=10);
int hello(); int hello();
}; };
......
...@@ -2,6 +2,11 @@ import simpleTest ...@@ -2,6 +2,11 @@ import simpleTest
s = simpleTest.simple() s = simpleTest.simple()
r = s.hello() r = s.hello()
print("hello returned " + str(r) + "\n") print("hello returned " + str(r) + "\n")
q = simpleTest.simple(var1=1, optional=2);
q1 = simpleTest.simple(1)
if r == 10: if r == 10:
exit(0) exit(0)
else: else:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment