Compare the Difference Between Similar Terms

Difference Between

Home / Technology / IT / Programming / Difference Between Abstract Class and Concrete Class

Difference Between Abstract Class and Concrete Class

June 22, 2011 Posted by Indika

Abstract Class vs Concrete Class

Most of the popular modern object oriented programming languages like Java and C# are class based. They achieve the object oriented concepts such as encapsulation, inheritance and polymorphism through the use of classes. Classes are an abstract representation of real world objects. Classes can be either concrete or abstract depending on the level of implementation of their method functionalities. A concrete class completely implements all its methods. An abstract class can be considered as a limited version of a regular (concrete) class, where it may contain partially implemented methods. Typically, concrete classes are referred to as (just) classes.

What is Concrete Class?

The default class is a concrete class. The class keyword is used to define classes (e.g. in Java). And usually they are simply referred to as classes (without the adjective concrete). Concrete classes depict the conceptual representation of real world objects. Classes have properties called attributes. Attributes are implemented as global and instance variables. Methods in the classes represent or define the behavior of these classes. Methods and attributes of classes are called the members of the class. Typically, encapsulation is achieved by making the attributes private, while creating public methods that can be used to access those attributes. An object is the instance of a class. Inheritance allows the user to extend classes (called sub classes) from other classes (called super classes). Polymorphism allows the programmer to substitute an object of a class in place of an object of its super class. Typically, the nouns found in the problem definition directly become classes in the program. And similarly, verbs become methods. Public, private and protected are the typical access modifiers used for classes.

What is Abstract Class?

Abstract classes are declared using Abstract keyword (e.g. in Java,). Typically, Abstract classes, also known as Abstract Base Classes (ABC), cannot be instantiated (an instance of that class cannot be created). So, Abstract classes are only meaningful to have if the programming language supports inheritance (ability to create subclasses from extending a class). Abstract classes usually represent an abstract concept or entity with partial or no implementation. Therefore, Abstract classes act as parent classes from which child classes are derived so that the child class will share the incomplete features of the parent class and functionality can be added to complete them.

Abstract classes may contain Abstract methods. Subclasses extending an abstract class may implement these (inherited) Abstract methods. If the child class implements all such Abstract methods, it becomes a concrete class. But if it does not, the child class also becomes an Abstract class. What all this means is that, when the programmer nominates a class as an Abstract, she is saying that the class will be incomplete and it will have elements that need to be completed by the inheriting subclasses. This is a nice way to create a contract between two programmers, which simplifies tasks in software development. The programmer, who writes code to inherit, needs to follow the method definitions exactly (but of course can have her own implementation).

What is the difference between Abstract Class and Concrete Class?

Abstract classes usually have partial or no implementation. On the other hand, concrete classes always have full implementation of its behavior. Unlike concrete classes, abstract classes cannot be instantiated. Therefore abstract classes have to be extended in order to make them useful. Abstract classes may contain abstract methods, but concrete classes can’t. When an abstract class is extended, all methods (both abstract and concrete) are inherited. The inherited class can implement any or all the methods. If all the abstract methods are not implemented, then that class also becomes an abstract class.

Related posts:

Difference Between Virtual and Abstract Difference Between Objects and Classes Difference Between Procedures and Functions in Programming Difference Between Hashtable and Hashmap Difference Between Implements and Extends

Filed Under: Programming Tagged With: Abstract Base Classes (ABC), Abstract class, Abstract keyword, Abstract method, C, child class, class keyword, concrete class, default class, Encapsulation, Inheritance, inherited class, Java, just class, members of class, object oriented concepts, object oriented programming languages, parent class, polymorphism, regular class, sub class, super class

About the Author: Indika

Indika, BSc.Eng, MSECE Computer Engineering, PhD. Computer Science, is an Assistant Professor and has research interests in the areas of Bioinformatics, Computational Biology, and Biomedical Natural Language Processing.

Comments

  1. Yogesh says

    November 4, 2017 at 9:00 pm

    excellent article!! good luck.

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Request Article

Featured Posts

Difference Between Coronavirus and Cold Symptoms

Difference Between Coronavirus and Cold Symptoms

Difference Between Coronavirus and SARS

Difference Between Coronavirus and SARS

Difference Between Coronavirus and Influenza

Difference Between Coronavirus and Influenza

Difference Between Coronavirus and Covid 19

Difference Between Coronavirus and Covid 19

You May Like

Difference Between Interrupt and Exception

Difference Between Address Bus and Data Bus

Difference Between Dog and Fox

Difference Between Mein and Meine

Difference Between Correlation and Covariance

Latest Posts

  • What is the Difference Between Herniated Disc and Piriformis Syndrome
  • What is the Difference Between Spinal Stenosis and Spondylosis
  • What is the Difference Between Lip Flip and Lip Filler
  • What is the Difference Between Bone Spurs and Plantar Fasciitis
  • What is the Difference Between Tension Pneumothorax and Cardiac Tamponade
  • What is the Difference Between Diverticulitis and Crohn’s Disease
  • Home
  • Vacancies
  • About
  • Request Article
  • Contact Us

Copyright © 2010-2018 Difference Between. All rights reserved. Terms of Use and Privacy Policy: Legal.