summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--oo/interface.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/oo/interface.php b/oo/interface.php
new file mode 100644
index 0000000..3f6c3f7
--- /dev/null
+++ b/oo/interface.php
@@ -0,0 +1,24 @@
+<?php
+
+/* interface contains only fixed-name declarations/stubs in with no access levels, yet it allows public,
+ * no ctors, no data members, no method definitions, no restriction on who implements this interface
+ *
+ */
+interface iDB {
+ const MAX_RECORDS = 5000;
+ public function query();
+ public function drop();
+}
+
+class MyDBDriver implements iDB {
+ public function query() {
+ echo "querying" . PHP_EOL;
+ }
+ public function drop() {
+ echo "dropping" . PHP_EOL;
+ }
+}
+
+$db = new MyDBDriver();
+$db->query() . PHP_EOL;
+$db = NULL;