Question

Select all that are true regarding abstract classes. A - They express all the properties and...

Select all that are true regarding abstract classes.

A - They express all the properties and behaviors common to their subclasses.

B - Calling the constructor will result in a compile time error.

C - Contain implemented methods.

D - Abstract classes can be used to create objects.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Correct Answer: A, C

Explanation:

Abstract Class:

An abstract class is a class that has at least one pure virtual function and this class never instantiated directly. This class is mostly used to define the base class in the class hierarchy.

Constructor:

In object-oriented programming, a constructor is a special method of the class that has the same name as the class name and it initializes the data member at object creation time.

The option 'A' is correct because an abstract class expresses the common properties of the subclasses.

The option 'B' is incorrect because a constructor is used to initialize the object automatically but an abstract class can't be used to create an object.

Option 'C' is correct because an abstract class can contain implemented methods.

Option 'D' is incorrect because an abstract class can't be used to create objects.

So, the option 'A' and 'C' are correct.

Add a comment
Know the answer?
Add Answer to:
Select all that are true regarding abstract classes. A - They express all the properties and...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Need help to create general class Classes Data Element - Ticket Create an abstract class called...

    Need help to create general class Classes Data Element - Ticket Create an abstract class called Ticket with: two abstract methods called calculateTicketPrice which returns a double and getld0 which returns an int instance variables (one of them is an object of the enumerated type Format) which are common to all the subclasses of Ticket toString method, getters and setters and at least 2 constructors, one of the constructors must be the default (no-arg) constructor. . Data Element - subclasses...

  • Select all correct options in the list below about concrete and abstract classes Select one or...

    Select all correct options in the list below about concrete and abstract classes Select one or more: a. Concrete classes can be instantiated b. Abstract classes must contain at least one abstract method c. Only concrete classes can be super classes d. Abstract classes (using the "abc" library) can be instantiated e. Concrete classes often contain abstract methods f. Both concrete and abstract classes can be super classes that other classes inherit from g. Only abstract classes can be super...

  • A Java Program Purpose:         Work with Abstract classes. Purpose:         Abstract classes are import because they ensure...

    A Java Program Purpose:         Work with Abstract classes. Purpose:         Abstract classes are import because they ensure than any children which inherit from it must implement certain methods. This is done to enforce consistency across many different classes. Problem:        Implement a class called Student. This class needs to be abstract and should contain a String for the name, and a String for the major (and they should be private). The class must have a constructor to set the name and major....

  • Exercise 8 (The interface class-like) Assume you have the Edible interface with its abstract method Design...

    Exercise 8 (The interface class-like) Assume you have the Edible interface with its abstract method Design a class named Animal and its two subclasses named Mammal and Dairy. Make Sheep and Bear as subclasses of Mammal and make Chicken and Cow as subclasses of Dairy. The Sheep and Dairy classes implement the Edible interface. howToEat) and sound() are the main two methods for all edible classes while sound() is the main method for the non-edible classes. 1. Draw the UML...

  • In this lab you will work with abstract classes/interfaces. (Java Program) You will be implementing a...

    In this lab you will work with abstract classes/interfaces. (Java Program) You will be implementing a basic employee schema within a company. The Employee class will be an abstract class that will contain methods applicable to all employees. You will then create 2 classes called SoftwareEngineer and ProductManager. Both are different employee types based on occupation. You will create an interface called Developer which will consist of specific methods that apply to only Developers (e.g. SoftwareEngineer class will implement this,...

  • Topic: JAVA 18) Abstract methods are used when defining A) interface classes B) derived classes C)...

    Topic: JAVA 18) Abstract methods are used when defining A) interface classes B) derived classes C) classes that have no constructor D) arrays E) classes that have no methods 32) Which of the following GUI classes requires that it have a LayoutManager before any GUI components are added to it? A) JButton B) JSlider C) JPanel D) JFrame E) both C and D but not A or B 33) In using the BoxLayout, adding space between components in a container...

  • (The interface class-like) Assume you have the Edible interface with its abstract method. Design a class named Animal a...

    (The interface class-like) Assume you have the Edible interface with its abstract method. Design a class named Animal and its two subclasses named Mammal and Dairy. Make Sheep and Bear as subclasses of Mammal and make implement the Edible interface. howToEat() and sound() are the main two methods for all edible classes while sound() is the main method for the non-edible classes. 1. Draw the UML diagram for the classes and the interface 2. Use Arraylist class to create an...

  • Java. For C through H True or false? c. Primitive variables must be objects. d. Integer...

    Java. For C through H True or false? c. Primitive variables must be objects. d. Integer x; generates a compile time error. e. Integer y = new Integer(); generates a compile time error. f. Integer z = new Integer(3); generates a compile time error. g. Integer u = new Integer(3.14); generates a compile time error. h. Integer w = new Integer("345"); generates a compile time error. 1.) What is true of classes that can be used with the enhanced for...

  • Abstract Classes and Interfaces. Write the code for all the necessary classes and/or interfaces for a...

    Abstract Classes and Interfaces. Write the code for all the necessary classes and/or interfaces for a solution to the problem below. Focus on class structure and interaction. You may implement your solution however you wish, but you will be graded on the appropriateness of your solution to the requirements. Note the use of capit and bold for clarification in the problem. You may use whatever constructors or additional methods you wish. - Define a structure that can represent Animals. -...

  • 44 A method signature defines which of the following? (choose all that apply) return type name...

    44 A method signature defines which of the following? (choose all that apply) return type name call parameters body 45 An abstract class can be implemented using the implements keyword. True False 46 An abstract class can be extended using the extends keyword. True False 47 Abstract classes are represented in UML by: italics underline plus/minus bold 48 An abstract class is a superclass for a subclass. True False 49 These symbols are used to denote an interface in a...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT