Pseudo OOP in C AND Go

This post I made because I just discovered an entry from long time ago, which I forgot to answer.

pseudo code:

int *method_to_append() {
 return 0;
}
void *do_something() {}
struct foo {
    int attribute1 : 0;
    int attribute2 : 0;
    int *method1 : method_to_append;
    void *method2 : do_something;
};
struct foo new_obj;
new_obj->method2();

2 thoughts on “Pseudo OOP in C AND Go”

  1. I thought it was more like:
    struct foo;
    int *method(struct foo *this) { return this->attribute1; }
    struct foo {
    int attribute1: 0;
    int *method1: method;
    }
    struct foo new_obj;
    new_obj->method1(new_obj);

Leave a Reply

Your email address will not be published. Required fields are marked *