Browse Source

Worked on Methods section of OOP chapter

pull/1/merge
Brett Langdon 14 years ago
parent
commit
228d4947ed
2 changed files with 5 additions and 0 deletions
  1. +5
    -0
      4 - Object Oriented Programming/1.1 - Classes and Objects.tex
  2. BIN
      Programming In General.pdf

+ 5
- 0
4 - Object Oriented Programming/1.1 - Classes and Objects.tex View File

@ -117,6 +117,11 @@ p.printName()
\end{lstlisting}
The output of this code would be \pigOut{brett}.
You access methods the same way as your would class properties except you include the parenthesis.
You may also notice a reference to a variable \pigVar{this} in the method definition.
This special variable is used within methods to refer to the object that the method belongs to.
So using \pigVar{this} within the method \pigVar{printName} is similar to using the variable \pigVar{p} to access
the specific instance that that method belongs to.
\subsection{Special Methods}

BIN
Programming In General.pdf View File


Loading…
Cancel
Save