Classes and Objects Flashcards
1
Q
A _____ is what we call a function inside of a class.
A
method
2
Q
A _____ is what we call a variable inside of a class.
A
property
3
Q
Describe a Class in object oriented PHP
A
An extensible template for creating objects, providing initial values for state and implementations of behavior.
4
Q
What are the three main areas of focus in regards to object oriented programming?
A
- Encapsulation
- a way to bundle or organize our data into a format that is easily readable and extensible
- also about controlling access to code by using visibility keywords to define if something is public, private, and so on
- Polymorphism
- it allows you to present a type of contract or requirements of a class that can be shared across many different class types
- a way for you to define methods that are shared, by implemented differently
- Inheritance
- a method of establishing relationships such as a parent is to a child or between classes or objects
- through a process of subclassing, you can create a heirarchy that gives the power of resuing a code defined by a parent
5
Q
Describe an object when related to OOP
A
Individual instances of Class created by using the new operand.
6
Q
_____ is a language mechanism for restricting access to some of the object’s components by using visibility keywords
A
Encapsulation
7
Q
Create a class called Fish.
A
<?php <br/>class Fish { } $bluegill = new Fish(); ?\>