Hello All, Do you know any application notes, tutorial, or example program that is using Object-Oriented Techniques in 8051 ? I heard about Abstract Data Type, Jump Table and so on. Thanks -Cahya
Wouldn't the application of OO Techniques be independent of the 8051 target? Jump Tables are not specifically Object-Oriented - Assembler programmers use 'em all the time! Have you looked at this: http://www.keil.com/pr/ceibo_020327.htm
Ic, but I am not intended to use C++. Only the OO techniques adopted into C51. May be a working example with description for certain CPU would be fine for learning.
// Becuase of the limitations of a 8051, // most(if not all) of your 'classes' should singletons // with statically allocated storage, // // I use the ClassName_Member notation on 'public' members // to mimic the ClassName.Member notation // // Here is one example of a singleton, statically allocated class: // // ClassName.h // extrn int ClassName_property1; extrn char ClassName_property2; void ClassName_Ctor(void); void ClassName_Dtor(void); int ClassName_Method1(char* p); char ClassName_Method2(void); // // ClassName.c // #include "ClassName.h" //public: int ClassName_property1; char ClassName_property2; //private: static int property1; static int property2; //public: void ClassName_Ctor(void) { ClassName_property1 = 0; ClassName_property2 = '\0'; property1 = 0; property2 = '\0'; }; //void ClassName_Dtor(void) //rarely used //{}; int ClassName_Method1(char* p) {}; char ClassName_Method2(void) {}; //private: static int Method1(char* p) {}; static char Method2(void) {}; // // Main.h // static void Ctor(void) { ClassName_Ctor(); //.. other Ctors } void main(void) { Ctor(); ClassName_property1 = 1; ClassName_Method1(1); while( 1 ); }
kind of this.. thank you