Foundational Definitions I
Mark Mzyk | February 13, 2008
I laid out the concept for this series here. In this series I’m going to go through Steve Yegge’s interview questions and answer each one to ensure that I do, in fact, know the answers. I’m also linking to the Wikipedia articles on each topic, for any one who wants to study further.
Is this a simplistic exercise? Yes, but it never hurts to review the basics. If I manage to completely screw something up, by all means, please correct me.
I’m skipping part one of Steve’s questions and going straight to part two, since Steve already gives all the answers to part one in his post.
Object Oriented Terminology
The objective: Simply define each term and compare and contrast as needed
1. Class and Object (And the difference between the two)
A class is a group of related methods, variables, etc. usually contained in its own separate file, but not always.
An object is an instantiation of a class.
2. Instantiation
Creating a specific instance of something general, or in the case of a variable, assigning it an initial value after its creation.
See the Object page for what Wikipedia has on the subject.
3. Method (As opposed to a C function)
It is a subroutine or procedure associated with a class or object, as opposed to a C-style function, which is not associated with a class or object.
4. Virtual Method and Pure Virtual Method
A Virtual Method is used in polymorphism. It is a method that allows child classes to have different implementations of the method from the parent class. A pure virtual method forces the children to implement the method (an example of this is a Java interface), whereas a non-pure virtual method does not have to be implemented by the child classes.
Virtual Method | Pure Virtual Method (Non-wikipedia site) | Polymorphism | Interface
5. Class/Static Method
This is a method that lives at the class level, meaning it does not operate on a specific instance of a class (i.e. an object). Because of this, it cannot operate on instance variables. When a method is static, it can be called without instantiating an object.
Class/Static Method| More Information (Non-wikipeia site)
That’s all for today boys and girls. Look for part II soon to follow.