I was reading a book about PHP when I ran into a strange part of code:
class Employee {
public function show() {
echo "show launched\n";
}
}
Employee::show();
I came from C++ so I was going to bet this code wouldn't work. This is why I tested it.
And it worked, showing "show launched" (omg, am I drunk?)!
It seems to be breaking the concept that method of class can be called without instantiation of class.
- What is the point then of static identifier in classes?
- Are all public functions static too? Really, what am I missing?
Thanks in advance.
Addition: Just a notice.
I found that in this book. Pages 178-179 and it's given as correct example (if I'm right)