C++: porque o constructor não é executado?

Cambalinho

Power Member
Código:
#include <iostream>

/////////For EVENTS//////////////
//Active the macros definitions:
#if defined __GNUC__
    #define EVENT [[gnu::weak]]
#elif defined __clang__
    #define EVENT [[llvm::weak]]
#endif

//test if the function was definided with with macro events:
#define IS_EVENT_DEFINED(sym) (static_cast<bool>(sym))

//define a macro for mouse events:
#define MouseEvents() EVENT void MouseClick();  EVENT void Move();

//a macro for create a class with events:
//seems like a variable declaration, but convert it to a class:
#define ClassWithEvents(ClassName, ClassParent) class ClassName: public ClassParent<ClassName>{public: ClassName() : ClassParent(this) { ; } ~ClassName(){ } MouseEvents(); }
////////////////////////////////

using namespace std;

template <typename ClassChild>
class Form
{
public:
    static int i;
    Form(ClassChild *test)
    {
        i++;
        cout << i << "\t";

    }
    ~Form()
    {

    }

};

ClassWithEvents(Window, Form);

int main()
{
    return 0;
}
eu posso adicionar 'Form' no fim da class... mas depois dá me erro por usar static :(
como posso usar uma variavel 'satic' no constructor usando ponteiro de entrada?
 
Back
Topo