Hi Vitaliy, I apologise for not posting anything yet about this subject, but I am trying to process all the information about it. The problem I have at the moment is that I just discovered that the CSS C compiler does not deal very well with function pointers especially in structs, hence is delaying my research into the subject. The first issue I had to overcome was the fact that I am not only writing a program using OOP I am also writing the infrastructure to generate the objects and actually that is the most important part. I will also start by not having inheritance but I can see how that could be done. The other issue I had is the "VTable" I could not understand its function. So this is how I am doing it: I have a function called checksumCalculator() which takes two parameter, an int bufferSize and an array of chars buffer which is the packet. It returns a char checksumCal which represents the checksum. To transform it into a class I created three, setSize, setBuffer, calculatechecksum. I also have three fields, bufferSize, buffer and checksumCal. So far all seems ok, but then what I envisage is a struct with the three fields and three function pointers one for each of the methods. When an instance of the class is created the three fields are initialised and the function address passed to the pointers. Is this what you do? I found that when I try this I can not manipulate the fields of the struct with the class methods, how did you get around that? I am probably making a mess out of this, so apologies in advance. Best Regards Luis -----Original Message----- From: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu] On Behalf Of Vitaliy Sent: 10 July 2009 08:42 To: Microcontroller discussion list - Public. Subject: Re: [EE] OOP in C on PICs Rolf wrote: >> Is this ANYTHING like how an OOP language works? >> >> Harold >> > In some ways, yes, but mostly, no. OOP is not as much about what happens in the code, it is more about what happens in the programmer's head. > Anyway, OOP is a concept that is implemented differently in different > languages. There are enough differences to make a discussion of OOP > somewhat difficult without referencing it to a particular language. Actually, I think the concepts translate well between different languages. The concepts of class, object, method, private, public, protected, encapsulation, inheritance, polymorphism, etc are common to all. > Some languages have similar OO Implementations (Java, C#, etc), but > others have significantly different implementations (Smalltalk - the > 'original' OO Language, and C++ - which although commonly used is > actually a bad example of an OO Language....!). AFAIK C++ is not considered a "true" OO language. IIRC, the main reason is that you can write a C++ program in the old-fashioned procedural way, without using a single object. > I would not know how to recommend to a person who is interested in OO > concepts how to proceed... whether to study the theory, thn be confused > by implementations, or whether to study one implementation, then get the > theory muddled..... My advice would be to read up on the theory first, the "Design Patterns Explained" book has an excellent section on OOP. Vitaliy -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist