Computer Science, asked by gopis2194, 9 months ago

Can an abstract class define both abstract methods and non-abstract methods

Answers

Answered by jaskaransahi75
0

Explanation:

In English

 Yes—an abstract parent can have both abstract and non-abstract children. ... A. No—if a class defines an abstract method the class itself must be abstract. B. No—only classes are abstract, not methods. C. Yes—a method can be declared abstract in any parent as long as the child classes also declare it abstract.

In Hindi

हां - एक सार माता-पिता दोनों सार और गैर-स्तरीय बच्चों के पास हो सकते हैं ... ए। यदि कोई वर्ग एक सार विधि को परिभाषित करता है तो कक्षा को सार होना चाहिए। बी। केवल केवल कक्षाएं सार हैं, विधियों नहीं हैं सी। हां-एक विधि किसी भी माता-पिता में अमूर्त घोषित की जा सकती है, जब तक कि बच्चे कक्षाएं भी इसका सार घोषित करती हैं।

Answered by vishakasaxenasl
0

Answer:

Yes, an abstract class can define both abstract and non-abstract methods.

Explanation:

  • You might hear about the term abstraction which means hiding the background details. Abstraction is one of the fundamental principles of object-oriented programming. Our abstract class also comes from the same concept of abstraction.
  • An abstract class is a class that has abstract methods and non-abstract methods. This class's methods are defined in the child class that extends it.
  • You can just write the signature of the method and leave it with empty curly braces. Then the class that extends it, will define the method. That is why it is called abstract because it hides all the details.
  • An abstract class can never be instantiated. It is created with the abstract keyword. Below is the syntax for creating an abstract class:

Syntax:

abstract class ClassName{

abstract method1();

abstract method2();

non-abstract method1(){

}

}

#SPJ2

Similar questions