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

  • Home
  • SEARCH
  • 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 6226019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T08:57:00+00:00 2026-05-24T08:57:00+00:00

How does the Virtual Differs in C++ and c#? basically i wanted to know

  • 0

How does the Virtual Differs in C++ and c#? basically i wanted to know is there any difference in the way Vtable is represented in C# and c++? Also is there any difference in the way the compiler creates the V Table in C# and c++?

Basically the interviewer wanted to know how does the compiler behaviour differrs for virtual functions in case of C# and c++.

I have answered the question mentioning there might be no difference in VTABLE expect that there is no Virtual Destructor in c#.

  • 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-24T08:57:01+00:00Added an answer on May 24, 2026 at 8:57 am

    (1) In C# one can choose to override a virtual function from base class. Both base and derived methods can have same syntax, but derived method can participate in polymorphism only if it uses the keyword override before it. See this answer for more details.

    In C++, if provided the same syntax method in derived class as base class virtual method; then it will be automatically be overridden. No choice.

    (2) To be short, in C# we have abstract methods and in C++ pure virtual methods. Both may not be exactly same, but are equivalent (as pure virtual can have function body).

    (3) In C++ we have choice to call virtual method without letting it participating in polymorphism. e.g. calling with an object, calling inside constructor.

    (4) In C++, if the base virtual method is public and derived method is private than there is no difference for virtual mechanism, when the method is called with base handle (pointer or reference). Which means that their access specifier can be different.


    Now coming to your 2nd question of how vtables are implemented. This is not really an objective question. Because in C++ itself different vendors implement the vtable in different ways (it’s not in standard as pointed by @littleadve). So for interview sake you can answer that, vtables are platform dependent.

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

Sidebar

Related Questions

I basically wanted to know what exactly a virtual processor is. At IBM's site
How does virtual functions work behind the scenes in Inheritance ? Does the compiler
Does anyone know why the STL containers don't have virtual destructors? As far as
Does using virtual methods violates LSP ( L part of SOLID principles) or there
When exactly does the compiler create a virtual function table? 1) when the class
How much difference does dedicated graphics and HDD speed matter when using virtual machines?
When i invoke a virtual function from a base constructor, the compiler does not
Is the vtable only used for virtual function lookups, or does it get used
How does a virtual machine generate native machine code on the fly and execute
As the title says really. Does the virtual keyword cause a performance hit?

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.