Simple Answers for OOP
Terms
undefined, object
copy deck
- What is polymorphism?
- One interface, many implementations. It allows you to invoke derived class methods through a base class reference during run-time. This is handy when you need to assign a group of objects to an array and then invoke each of their methods.
- What is an Interface?
- An interface looks like a class, but has no implementation. They are great for putting together plug-n-play like architectures where components can be interchanged at will. Since all interchangeable components implement the same interface, they can be used without any extra programming. Example is the remote interface that defines an increase method. The tv and radio class have a getremote method that, when called, return a anonymous class that implements remote or a class that inherits from remote like "tvremote". We can now call increase on the remote objects to increase the volume of these to appliances.
- What is abstract?
- Abstract classes are like super classes that define specific behavior that all derived classes must adhere to. It is used when you have some sort of default method behavior for sub-classes. Abstract methods must be defined in derived classes.
- What is a delegate?
- A delegate is basically a function pointer. It is used for a callback situation like for example in an event driven model.
- What is a virtual method?
- It's a method that a derived class defines so that you could loop through the a bunch of base objects and execute this method, thus executing the derived class method.
- What is static?
- The static keyword is used to signify elements that don't require an instance to utilize. That is, the static member belongs to the class itself. Not the instance.