Criado por José Alfredo Santes Benítez
mais de 7 anos atrás
|
||
Questão | Responda |
Abstract Class | Classes defined as abstract may not be instantiated, and any class that contains at least one abstract method must also be abstract. |
Abstract Methods | Methods defined as abstract simply declare the method's signature - they cannot define the implementation. |
What to do if I have an abstract class with abstract methods? | When inheriting from an abstract class, all methods marked abstract in the parent's class declaration must be defined by the child; additionally, these methods must be defined with the same (or a less restricted) visibility. |
What to do if I have an abstract protected method? | If the abstract method is defined as protected, the function implementation must be defined as either protected or public, but not private. |
Is it the same interface and abstraction? | No, an abstract class can provide some functionality and leave the rest for derived class, and the interface cannot contain any functionality. It only contains definitions of the methods. |
Characteristics Part 1 | The derived class may or may not override the concrete functions defined in base class The child class extended from an abstract class should logically be related |
Characteristics Part 2 | Methods that are declared as abstract will not contain method body or method implementation. It can have only the method signature When inheriting from an abstract class the child class must implement all the methods named as abstract in the parent class |
Characteristics Part 3 | When inheriting from an abstract class the abstract methods implemented in the child class should be of the same or lesser visibility Abstract classes may have non abstract methods (which has a method body) you cannot implement an abstract class, you can only extend it |
Quer criar seus próprios Flashcards gratuitos com GoConqr? Saiba mais.