Abstract Methods: Difference between revisions
From charlesreid1
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
==Abstract Methods== | |||
"What is an abstract method?" | "What is an abstract method?" | ||
| Line 16: | Line 18: | ||
(Side note - Golang only implements "object oriented programming" through interfaces, which are more like functional C structs than Java's everything-is-an-object.) | (Side note - Golang only implements "object oriented programming" through interfaces, which are more like functional C structs than Java's everything-is-an-object.) | ||
==Flags== | |||
{{DataStructureFlag}} | |||
Revision as of 05:37, 1 June 2017
Abstract Methods
"What is an abstract method?"
versus,
"Explain what an abstract method is. How it works."
If they don't specify, start with one, then the other. Write a short outline of what you're covering on the board. And have your mental picture in mind.
Give a 2-3 sentence definition, and then elaborate on the whiteboard.
The abstract method is a method definition in a class that is intended to be extended via inheritance, and it imposes restrictions on classes extending this class, to ensure a consistent interface.
This is the idea behind Interfaces: not-quite-classes, classes lite,
Classic example: MakesNoise interface. Babies, and Monster Trucks. Don't want inheritance, you want an interface.
(Side note - Golang only implements "object oriented programming" through interfaces, which are more like functional C structs than Java's everything-is-an-object.)