Lambda "da ? ", on the summer grill ! #250
Closed
VladLio
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
All the code well compile, But, there is some smoke with result !! Neighborhood should call 911 !!?
#include
#include
#include
#include
using namespace std;
class Test2
{
public:
Test2(int init) : my_Int{ init } {};
int OneFct(int a) { std::cout << "a = " << a << "\n"; return(0); };
private:
int my_Int{ 0 };
};
using Fct = int(Test2::*)(int);
class Test1
{
public:
Test1(int init, Fct F) : my_Int{ init }, ExOne{ F }, ExTow{F} {};
Fct ExOne{ nullptr };
int OneFct(int a) { std::cout << "my_Int = " << my_Int << "\nEx = " << ExOne << "\n"; return(0); };
Fct ExTow{ nullptr };
void UseLbd() { std::cout << "lbd =" << ExTow << "\n"; };
private:
int my_Int{ 0 };
};
int twoFct(int a, Fct B) {
std::cout << "B = " << B << "\n";
return(0);
}
int main()
{
Test2 A{ 22 };
Fct fct{ &Test2::OneFct };
Test1 B{ 11, fct };
B.OneFct(44);
twoFct(3, fct);
auto lbd1{&A->int{return(A.OneFct(55));}};
B.UseLbd();
}
Beta Was this translation helpful? Give feedback.
All reactions