Hello together. (Pleas read twice before you start to answer !) There are now 3 projects I know using NASM for there backend tasks and link it together with the front end c++ code. I think I do the same, until c++ has a pointer object (reserved word, type like object_ptr myallover_ptr) that can be assigned with every names address ( &classname, &membername, &myfunction, &myvalue, &main, myptr, &myarray[2], ....) in the same name space. In that scope a second mechanism is needed to define, redefine the contents of Such A Pointer (from now on SAP), to define its usage - ...
SAP = MyClass->&myfunction call void SAP(); // call is my favorite for execution. Because void SAP( int value1 ); //can be read as a declaration, but should be executed. and usage_cast< SAP > void SAP( int value1 ); // would not be handy enough ... int myvar = call int SAP( int value1 ); //SAP holds a pointer (to a function?) MyClass *pointer = SAP SAP = &myvar; SAP = myvar //error: only pointers are allowed ... More examples: char *mypointer = SAP; int func( int, char ); SAP = &func; //not: func(...) - it is not executed ------------------declaration class my1{ int myval; void func1(); } class my2{ int myval; void func2(); } class my3{ int myval; void func3(); } my1 *m1; my2 *m2; my3 *m3; SAP *SAP1 //or however it has to be defined. SAP *array; ------------------code m1 = new my1; m2 = new my2; m3 = new my3; array = new SAP[500]; array[2] = &m3[1] //->func3, the address of the second object is assigned. SAP1 = m1->&myval; SAP1 = m2->&func2; call SAP1; call void SAP1(); //but call void SAP1( int i ); //is an (error) in that scope //The tracking of SAP can be done only inside of a class. //If in one class SAP gets something assigned and in an other it gets executed //then this above would be no error. The value of SAP can't then be tracked. ------- You'll ask when you need such a reserved word (SAP, call), wouldn't be very often -> well, in every case you want to program OO that does not fit in the class structure. That's not seldom. In my case it is at 2 of 3 projects, or if you have special switches or ... Or more simple: With C++ you do OOP but your are not allowed to program OO. That's a very big difference. Now I understand when my professor said " OOP will not exist a long time" and every one was then programming OO in Pascal or Fortran or assembler. Now you have OOP in that languages, too (not assembler). If the writing of that all above would be possible, then you can also programm OO in C++. That would bring very much power to C++. But it is like a revolution. A devil that breaks though the tidily structur of C++, like in the real life, too. The need of this all is underlined by this side: http://www.parashift.com/c++-faq-lite/pointers-to-members.html#faq-33.4 Programmers need an easy to use language and not a highly work around one. I often have the feeling with c++, - how can I crack it, and not, - well, let's do it. For normal use c++ is a very fine thing and well designed. But it allows only one strategy to get to an app. And there you waste most of the time to squeeze your backend tasks in that structure. A beginner can't use SAP, because its programs won't link or run. He has to learn the use of classes and members like all others before, too. But when he grows up and his tasks become more and more complex then he can do it and not only that but more - all. - think about, ... how it is in pascal, fortran, assembler, vtable, pointers are only values in registers BP-16, EBP-32, RBP-64 or memory, every defined name in c++ is a pointer of the same type int_16 or int_32 or int_64 system(CPU) dependent. A pointer is pointing to what, Does it matter? A class is an array of count member pointers. Functions - push, pop, stack overflow, mismatch. ... - maybe 20 minuts, ... - then read again. bastl