 | Discussion Forum |  |
|
|
Object-Oriented Techniques with C51Next Thread | Thread List | Previous Thread Start a Thread | Settings | Details | Message |
|---|
Read-Only Author Cahya Jatmiko Posted 13-May-2002 08:24 GMT Toolset C51 |  Object-Oriented Techniques with C51 Cahya Jatmiko 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 | | Read-Only Author Andrew Neil Posted 13-May-2002 09:31 GMT Toolset C51 |  RE: Object-Oriented Techniques with C51 Andrew Neil 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 | | Read-Only Author Cahya Jatmiko Posted 13-May-2002 09:43 GMT Toolset C51 |  RE: Object-Oriented Techniques with C51 Cahya Jatmiko 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. | | Read-Only Author Jon Young Posted 13-May-2002 17:09 GMT Toolset C51 |  RE: Object-Oriented Techniques with C51 Jon Young
// 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 );
}
| | Read-Only Author Cahya Jatmiko Posted 14-May-2002 10:49 GMT Toolset C51 |  RE: Object-Oriented Techniques with C51 Cahya Jatmiko kind of this.. thank you | |
Next Thread | Thread List | Previous Thread Start a Thread | Settings |
|