justin@HPCC01.CORP.HP.COM (Justin Chang) (04/04/91)
Okay, could someone out there clearly explain the concept of "object-oriented" programming/programs to a person with an EE background. My colleague, just asked me about this. I told him that it's no different than previous programming techniques except for the fact that the data units are now "super-variables",i.e. it could represent just about anything. I know there is probably more to this than what I said to him. Again could someone explain what the concept is and the major advantages (and disadvantages) over previous methods of programming? Thanks in advance, Justin
louisg@vpnet.chi.il.us (Louis Giliberto) (04/07/91)
In article <3040001@hpcc01.HP.COM> justin@HPCC01.CORP.HP.COM (Justin Chang) writes: > > >Okay, could someone out there clearly explain the >concept of "object-oriented" programming/programs >to a person with an EE background. My colleague, >just asked me about this. I told him that it's >no different than previous programming techniques >except for the fact that the data units are now >"super-variables",i.e. it could represent just >about anything. > >I know there is probably more to this than what >I said to him. Again could someone explain what >the concept is and the major advantages (and >disadvantages) over previous methods of programming? > >Thanks in advance, > >Justin Ok. An Object bundles data & functions/procedures. It is kind of like a record like this (compare to Pascal) Object = record Var1: Integer; Var2: Integer; Procedure1 (Var SomeVare: Integer); Function1 (FunctionVar: Char): String; End; MyObject: Object; So, if you want to access Procedure1, you do this: MyObject.Procedure1(666); One of the best things about Objects is that you can change procedures and stuff in an object without the source code. Say I want to implement my own version of Procedure1. I can do so like this: MyObject: Object; Procedure MyObject.Procedure1(Var somestuff: Integer; Otherstuff: Real); [body of procedure] So when my program calls MyObject.Procedure1 it executes the new stuff. The other stuff stays the same. You can also use an object in a new object. Objects are especially handy with graphical user interfaces. At any rate, this is a very very crude explanation. I haven't done too much OOP, and I'm certainly no expert on it. But, I hope it helps. Louis Giliberto louisg@vpnet.chi.il.us -- --------------------------------------------------------------------------- ! "As above, so below; as below, so above" -- The Kybalion ! ! "I don't trust him; he has dark hair" -- My girlfriend's mother ! ! "So I'm stupid; what's your point?" -- Me !