Can abstract classes also contain abstract properties?

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter11: Advanced Inheritance Concepts
Section: Chapter Questions
Problem 3RQ
icon
Related questions
Question

Can abstract classes also contain abstract properties?

Expert Solution
Step 1: Justification

Yes”, an abstract class can also contain abstract properties.

Justification:

  • An abstract property is a property that appears in a base class but expects to be overridden in a derived class.
  • The programmer must declare the “abstract” keyword before the property type in a base class.
  • To implement an abstract property in a derived class, the programmer must use the “override” keyword.
  • If want to create a variable, the variable's data type should be same as property's data type.
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Reference Types in Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning