#What is the difference between member function and main function???
17 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.
Ok what is the difference between a void header function in a struct and just a void function in the main.cpp?
This works ```#include "Simple.h"
#include <iostream>
#include <thread>
#include <vector>
#include <functional>
#define MAX 1;
void Foo(int num)
{
std::cout << num << '\n';
}
int main()
{
simplebot bot;
bool running;
LPMSG msg;
int MAXLENG = 30;
std::vector<std::function<void()>> mem;
mem.push_back(std::bind(Foo, 1));
#include "Simple.h"
#include <iostream>
#include <thread>
#include <vector>
#include <functional>
#define MAX 1;
void Foo(int num)
{
std::cout << num << '\n';
}
int main()
{
simplebot bot;
bool running;
LPMSG msg;
int MAXLENG = 30;
std::vector<std::function<void()>> mem;
mem.push_back(std::bind(bot.LClick, 1));```
But not this???
But i included it thru a header
and i instanced the structure
class methods that look like they take no argument actually always take the 'this' ptr as an argument, so they're not equivalent to a function with void() signature
void header is a forward declaration in the .h files
So how do it get around that?
Do i have to deref it some how?
This probably gives the solution you're after.
https://stackoverflow.com/questions/52769059/replacement-for-removed-bind1st-in-c17
Use the placeholder arg to bind the instance
Oof unfortunately not
Top 10 most genius questions
A main function and member function isnt different when being compiles
but when using the programming language, member functins are kindof like folders
u have have folders and subfolders for functions
in ur case ur refering to them as members
This question thread is being automatically closed. If your question is not answered feel free to bump the post or re-ask. Take a look at !howto ask for tips on improving your question.