This is my main function
#include <iostream>
#include "functions.h"
using namespace std;
int main()
{
functions LPG;
LPG.diff();
return 0;
}
Ubuntu says this file(main.cpp) has an error.
// functions.h
#pragma once
#include <iostream>
class functions{
public:
void diff(int error);
};
// functions.cpp
#include <iostream>
#include "functions.h"
using namespace std;
`functions::diff(int error){
error = error;
void diff2(){
error = 0;
cout << "Joe Mama Testing 123";
void easy(){
cout << "Joe Mama Again"
}
}
}
Ubuntu says that diff is a non function Someone please help me and this is not a joke I put joe mama because I want to test the class. Please help me as soon a possible.
You can declare diff2
as a lambda function. That would allow you to have a function within a function.
void functions::diff(int error) {
error = error;
auto diff2 = [&error](void) {
error = 0;
cout << "Joe mama testing 123";
auto easy = [](void) {
cout << "Joe mama again";
};
easy();
};
diff2();
}
Not sure how you want to call diff2() and easy(), though.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.