answersLogoWhite

0


Best Answer

Below is the main difference between the 3 components:

  • Concrete class - Provides implementation for all its methods & also for methods from extended abstract classes or implemented interfaces
  • Abstract class - Does not provide implementation for one or more of its methods
  • Interface - Does not provide implementation for any of its methods
User Avatar

Wiki User

14y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

13y ago

You cannot instantiate an object of an abstract class.

Example:

You might have two objects 'man' and 'woman' which inherit common characteristics (two eyes, a nose etc) from 'human'. You wouldn't want humans that are neither walking around so you make human an abstract class as you'll never need a human object.

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

Assume a "simple" class be a class without the keyword "abstract".

You cannot create an instance of an abstract class. An abstract class is intended to be inherited from (to be extended or derived from).

A "simple" class is a class that an instance can be created from (via new operator)

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

Normal variables or static variables are declared and use in class but abstract class had only static variables. You have declare and define the methods in class. But abstract class only allow for method declaration only. The abstract class like interface.

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

An Abstract class is a special kind of class that cannot be instantiated. It has one or more methods which are not implemented in the class. These methods are declared abstract and they do not contain any code inside them.

Ex:

abstract class Parent {

public abstract String getSon();

public abstract String getDaughter();

....

....

//More methods that contain specific behaviour/code in them

}

The above is an abstract class "Parent" that has a lot of functionality but it has declared two abstract methods which have no code inside them. Any class that has one or more abstract methods has to be abstract. This abstract class cannot be instantiated.

i.e., the below piece of code will not work. The code will not even compile.

Parent object = new Parent();

Purpose of Abstract Classes:

Abstract classes are generally used where you want an amount of behaviour to be used by the class that extends the abstract class while at the same time giving options to the child class to provide a certain amount of behaviour itself.

A Child Class extending the Abstract Class:

public class Child extends Parent {

public String getSon() {

return "Sons Name";

}

public String getDaughter(){

return "Daughters Name";

}

...

... //Code specific to the Child class

}

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

In general programming terms, a concrete class is one which can be instantiated, while an abstract class can only be instantiated via a fully implemented subclass.

This answer is:
User Avatar

User Avatar

Wiki User

10y ago

Abstract classes are classes that can't be instantiated directly. In other words, you are meant to create subclasses, which you instantiate.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What are the differences between class and abstract class?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is the difference between abstract class and normal class?

Any class which has one or more abstract methods is called an abstract class. But in the normal class we can't have any abstract methods. We cannot create an object for the abstract classes. When we inherit the abstract class we should implement the abstract method which we inherit.


What is the difference between abstract class and final class?

20


Difference between interface and abstract class on uml?

In general, the differences are that interface has(1) no fields and(2) no implementation of methodsbut in UML interface may have features (fields), so the difference left is that interface in UML has no implemented methods while abstract class by definition is partially implemented class.


What are the main differences between the Class 90 and Class 91?

The main differences between the Class 90 and Class 91 were comfort whereby Class 91 was more comfortable.


What is the difference between association class and abstract class in software designing?

Association class is describing the relationship between classes. An abstract class is just 1 class, provides some abstraction behaviors that may be (but do not have to) derived, overridden from.


Difference between abstract and final class?

Abstract class is built to promote inheritance whereas a final class is built to avoid inheritanceAn Abstract class can be extended by another class whereas a final class cannot be extended


What is difference between abstract class and interface in core java give brief answer with example?

Differences:Abstract class can also contain method definitions but an interface can contain only declarationsAll variables in an interface are by default public static and final whereas in Abstract class it is notAn interface can be considered as a pure abstract class that contains no method implementations and contains only declarations.


How do you write concrete method inside abstract class?

There is no difference with method declaration and implementation between abstract and non-abstract classes. You do the exact same thing when writing a concrete method in either an abstract or non-abstract class.


Is an abstract class virtual by default?

Unlike abstract class in C++, the abstract class in C# does not have any methods defined as virtual by default. The concept of virtual are not the same between C# and C++, either. Any virtual method must be defined explicitly in C#. Related to abstract methods - interestingly, an abstract class in C# does not have to have any abstract methods. However, the reverse, if a class need to have at least one abstract method, that class must be defined as abstract.


What is the similarity between abstract class and class?

They provide the same level of abstraction and encapsulation, and similar inheritance. The differences in inheritance: an abstract class forces you to have at least 1 subclass (otherwise this abstraction branch is useless, because you won't be able to create any instance), while a non-abstract class may have optional subclasses.


What is an abstract class Write the syntax Declare a pure virtual function in an abstract class?

an abstract class is nothing but class which contains both abstract and concrete methods for abstract class we r nt create object Syntax for pure abstract class is abstract class x { public void abstract y(); public void abstract z(); public void abc() { }


What are the key differences between naturalistic drama and abstract (non naturalistic) drama?

The conventions