> Hello Saaa, > >> How should I do this then? > > C c; > C2 c2 = new C2; > C3 c3 = new C3; > c=c2; > > auto dg = { return c.method(); }; > > c=c3;
I actually did it like this before :) Thanks But like this I need to do the "c is null" checking within the function literal. I'm not sure how these function literals are implemented; will the size of the function have any impact on speed? Or does the compiler handle them like any other function and just thinks of a name itself ?