Hm what are u guys talking about...well, for one, I wouldn't try to write OO is asm - when I have c++ I'll just use that for now. But I do remember seeing a nice book at the bookstore all about asm and OO in asm and everything. Pretty cool.
Anyway, OO is just pointers to objects anyway, in asm it's not that big of deal.
Maybe ja187 would find this interesting (rest of use know this stuff already):
Say you have a object "Homework" from class "CHomework"
Code:
class CHomework
{
private:
char Grade;
public:
CalculateGrade(PAPER* ThePaper);
};
and now in code you create the object
Code:
CHomework* MyHomework;
PAPER MyPaper;
MyHomework = new CHomework();
MyPaper = "this is the difference between asm and.....";
MyHomework->CalculateGrade(&MyPaper);
In memory your object exists, the object itself is just data but the same functions getted called or all objects of that class. In other words if you have a MyHomework2 and call CalculateGrade it calls the same function in memory as MyHomework does. The function knows which object to work on because of a hidden "this" pointer that gets passed in along with the normal argument.
Anyway in asm it looks more like this....
Code:
mov ebx, <pointer to object> <- remember a pointer is a variable too
mov eax, [ebx] <- eax now has object address itself (that pointer pointed to)
mov ebx, <pointer to PAPER structure>
mov ebx, [ebx] <- get the paper structure address from the pointer
push ebx <- pass in argument
push eax <- pass in "this" pointer
call [eax + 0x1C] <- call function on object
Guys correct me if I'm wrong, I'm a bit rusty since I've been away from my computer for a couple of months doing other things.
-nt20