Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7644227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:38:04+00:00 2026-05-31T09:38:04+00:00

Whats the difference between an Interface and Handle Handle – Implementation is in another

  • 0

Whats the difference between an Interface and Handle

Handle – Implementation is in another class (Handle : Exposes all the functionality of a class, but the actual implementation is coded in another class. Handle contains pointer to the implementation class(pimpl idiom). Handle is like a wrapper class.)

Interface – Implementation is in the derived class

Is this is the only difference ?

Where do we use Interface, and where do we use Handle ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T09:38:06+00:00Added an answer on May 31, 2026 at 9:38 am

    “Handle” doesn’t have a widely agreed upon meaning with respect to C++. Different people use it to mean entirely different things (e.g., on Windows, “handle” does have a fairly well-defined meaning, so people programming Windows in C++ tend to use it the way Windows does).

    As far as implementation in another class, that sounds more like a pimpl than what most people would usually call a handle. If that’s the sort of thing you’re talking about, it’s quite a bit different from inheritance in both implementation and use. In fact, in many ways it’s kind of the opposite: inheritance allows classes that are different from each other to be treated as if they were the same. With a pimpl, you have two classes that are identical (in some ways) but you still keep them entirely separate.

    As to where/why you use them: with an interface (usually an ABC, in C++) you allow new derived classes to be manipulated via an existing interface, so existing code can use your new code without that existing code needing modification to do so.

    pimpl is typically used primarily as a compiler firewall — if you have some code that’s changing frequently, but you don’t want to re-compile everything that depends on it every time you change it, a pimpl can be helpful (though definitely not a panacea).

    A handle is typically used to mean an opaque data type — a “magic cookie” that gives you access to some capabilities, but which you can’t/don’t look at or manipulate directly at all. To some extent, you could consider any reference/pointer to almost any class as a handle (of sorts), but it’s pretty unusual to hear/see the term used that way. More often it’s something like a FILE * in C — when you call fopen, it gives you the FILE *. Anytime you want to operate on the handle you opened, you pass that same FILE * back to the function you’re going to use. You, however, aren’t ever supposed to look “inside” to see what it points at, how that’s used, or much of anything else (and at the Unix level using open/lseek/lread, etc., a file descriptor is pretty much the same way).

    Perhaps you’re thinking of something close to the handle/body idiom that was popular in relatively early C++. In this idiom, you did have implementation in another class. Specifically, the “handle” typically provided reference counting, and the body the implementation of whatever actions were needed on the single item to which you had those multiple (counted) references. The handle “handled” the reference count, and passed almost everything else through to the implementation class. This usage is no longer common for the simple reason that reference counting has largely fallen out of favor. Especially in a multi-threaded environment, reference counting can (and frequently does) have fairly substantial speed penalties, so its use is now relatively unusual (where at one time it was nearly expected of most classes that might manage substantial amounts of data).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Whats the difference between variable declared in interface (in .h file) and in implementation
Whats the difference between: @interface SomeClass : NSObject { NSObject *something; } and @interface
What is the difference between abstract class and interface in Python?
What exactly is the difference between an interface and an abstract class?
Possible Duplicate: PHP: What is the difference between an interface and abstract class? As
What is the difference between: type IFooable = interface IDisposable abstract Foo : (unit
What is the difference between these two pieces of code type IInterface1 = interface
What is the difference between + and - before the function name interface declaration
Whats the difference between Cast & Convert in C# 2008?
Whats the difference between SELECT DISTINCT field1 FROM table1 cd JOIN table2 ON cd.Company

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.