def obj()

Gert Cuykens gert.cuykens at gmail.com
Thu Feb 8 18:48:32 EST 2007


#include <stdio.h>

function hello(){
    struct obj = { char *data = 'hello'}
    obj.add = obj_add(obj);
    return obj;
}

function obj_add(obj){
    function add(value){
        obj.data += value;
        return obj;
    }
}

main(){
    test = hello();
    test.add('world');
    printf(test.data);
}

I was thinking something like this maybe ?



More information about the Python-list mailing list