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 7866509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T00:25:17+00:00 2026-06-03T00:25:17+00:00

I come from a C# background and have recently started learning C++. One of

  • 0

I come from a C# background and have recently started learning C++. One of the things I’ve encountered is the pimpl idiom. I’ve done C# development for some large firms, but never came across it.

Maybe this is wrong, but my understanding is that it’s necessary in C++ because of the use of header files and no partial class option.

But in C# we would build applications using class libraries all the time. If something changed in the library code, we would recompile it to a dll and reference the new dll in the application project.

I don’t really understand why the same thing can’t be done with C++. Pimpl just looks like an ugly hack to me.

  • 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-06-03T00:25:18+00:00Added an answer on June 3, 2026 at 12:25 am

    Is the pimpl idiom used in c#?

    That depends on what you mean by this idiom.

    The idiom in question is essentially to separate the implementation details of a type into one class, and the public surface area into a wrapper class that simply holds onto a pointer to the implementation class.

    This has two benefits.

    First, in C++ it can lead to improvements in compile time because consumers of the public surface area need only to parse the header file containing the public surface area; they need not parse the header file containing the implementation details.

    Second, it leads to a very clean separation of interface from implementation; the implementation can change utterly without there ever being any impact upon the consumer, because the consumer never sees the implementation details.

    The first benefit is of no matter in C#. The C# compiler is fast. (In large part of course because the language was designed to be fast to compile.)

    The second benefit is of considerable use in C#. In C# the idiomatic way to implement this pattern would be to make a private nested class that does the “real” work and a public class that is just a facade with the public surface area.

    A technique I particularly like in C# is to make the public class the base class of the private nested class, give the base class a private constructor to prevent third party extension, and use the factory pattern to hand out instances of the private nested class.

    I don’t really understand why the same thing can’t be done with C++.

    Then I encourage you to attempt to write a C++ compiler that does so. You’ll either succeed in creating a much faster C++ compiler, or you’ll find out why the same thing cannot be done in C++. You benefit either way!

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

Sidebar

Related Questions

I have recently been thrown into learning ClearCase (I come from a background with
I come from a Java background and have been using C# for the last
I come from Java Background and so used to Debugging using Eclipse but have
I am a .NET developer now and have come from Foxpro /VB6/COM background. Over
I come from Java background, where we have data structures with interfaces that if
I primarily come from a PHP background but I have been asked to develop
I come from a background where I normally create one file per class. I
I come from MySQL background and I am trying to learn MongoDB. I have
I'm new to WPF and come from a WinForms background and have a fairly
I come from a C# background and I have a bit of a tough

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.