Job Interviews OOP Concept

Abstracts Class VS Interfaces Top Programming Concept

Written by Techringe

List of Best Programming interviews Questions with Examples. Top OOP(Object Oriented Language) concepts with examples.Difference Between Abstract Class and Interfaces.

Abstracts

An abstract class is, conceptually, a class that cannot be instantiated and is usually implemented as a class that has one or more pure virtual (abstract) functions

Example

class Abstract Class {

public: virtual void AbstractMemberFunction() = 0; // Pure virtual function makes

// this class Abstract class. virtual void NonAbstractMemberFunction1(); // Virtual function.

void NonAbstractMemberFunction2(); };




Interfaces

An interface has no implementation.
An interface class contains only a virtual destructor and pure virtual functions.

Example

class shape // An interface class {

public: virtual ~shape(); virtual void move_x(int x) = 0;

virtual void move_y(int y) = 0; virtual void draw() = 0; //… };

 

About the author

Techringe

techringe.com is Platform which offers Free download latest project source code in java, android, php, html, c# .net, c/c++, iphone, vb, python, jsp, asp .net, all programming lanugage.

Leave a Comment