Need help understanding OOPs terminology

Need help understanding OOPs terminology

Post by Mike » Fri, 22 Apr 2005 23:51:48


Hey guys, need some help understanding some things that maybe someone can
explain or clarify it a little better then a text book. Here is my
understanding so far:

Class - basically a shell for your code

Fields - basically just a variable but can be "write protected"

Properties - access fields, they can retrieve data contained in the
"variable"

Methods - Used for calculations, or can retrieve data from objects such as
combo boxes and text
fields, methods can also start sub procedures or another set of
instructions.

Constructors - special method that runs that runs and can assign a new value
to fields

Am I close on any of these?? Thanks guys!!

Mike
 
 
 

Need help understanding OOPs terminology

Post by Sean Heder » Sat, 23 Apr 2005 07:29:48


You're close on all of them, I've just redone it for you emphasizing the
similarities between the various components.

Class - A "template" for objects. Best analogy for this: the class is the
cookie cutter and the objects are the cookies.
Members - Something defined on a class. Basically these make up the "shape"
of the cookie cutter. All members have a visibility (public, private, etc)
Field - A type of member that is a variable with class scope. Fields can be
readonly, which means they can only be set at object creation.
Method - A type of member that contains executable code. They can be divided
into two main types: functions (which return values) and procedures (which
do not).
Property - A type of member that has similar usage semantics as fields do.
Unlike fields, properties do not allow direct access to the underlying
variable, but control access to it through one or both of two special case
methods: the get and set accessors. The get accessor is a function, and the
set accessor is a procedure.
Constructor - A type of member that is effectively a method. It is used to
construct the object. It is the only method that can modify readonly fields.

 
 
 

Need help understanding OOPs terminology

Post by Mike » Sat, 23 Apr 2005 22:15:26

Thanks Sean that helps!

I found a pretty good (a little surprised) white paper on creating classes
in VB.NET.

It took 7 pages to describe what and how to use classes whereas the book I
have only took 4!

Thanks again!!

Mike