Amazon Interview Question
Software Engineer / DevelopersCountry: United States
Abstract classes allow default function declaration using abstract keyword and can't be instantiated.
Normal class can be instantiated as all the methods are defined.
abstract class DBMS
{
abstract <returntype> SELECT(<type> syntax);
abstract <returntype> INSERT(<type> syntax);
}
class ORACLE extends DBMS
{
<returntype> SELECT(<type> syntax){}
<returntype> INSERT(<type> syntax){}
<returntype> SOMETHINGELSE (<type> syntax){}
}
Abstract class can't be instantiated , while other class can be .
- NaiveCoder March 19, 2012for eg :
We can make the media as an abstract class
while Video and audio are the sub class inherited from media class