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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T00:20:12+00:00 2026-06-02T00:20:12+00:00

I don’t know if it is possible, but there is simple example what I

  • 0

I don’t know if it is possible, but there is simple example what I should achieve:
I have to use the first pure virtual function, because there are a lot of derived classes that needs it. But a few derived classes needs the second parameter too.

There is the base class Car:

public ref class Car abstract
{
.....
public:
  virtual void move(Road ^ road) = 0; //I am not allowed to delete this line
  //virtual void move(Road ^ road, Parameter2 ^ parameter2) = 0; //overload
}

Is it possible to overload the pure virtual function? Or in the worst case to disable that function in that few classes which need two parameters?

I am just learning, sorry for stupid questions..

  • 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-02T00:20:13+00:00Added an answer on June 2, 2026 at 12:20 am

    It is certaily possible to overload a virtual function. Which one is called is based on the number (and type) of the function parameters. Note that pure virtual functions (‘=0’) impose the requirement on all derived classes to implement all pure virtual functions of the base class (or be abstract themselves as well, passing down the requirement to further derived classes).

    If you can modify the signature/body of the first declaration, you can get away with only one function, though:

      virtual void move(Road ^ road, Parameter2 ^ parameter2 = 0) = 0;
    

    which assigns a default parameter to parameter2, when none is supplied explicitly at the time of calling. Then have the logic be identical to your first case (no parameter2), when the value of parameter2 is 0.

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

Sidebar

Related Questions

Don't really know how to formulate the title, but it should be pretty obvious
Don't know how to google for such, but is there a way to query
I don't know whether this is really possible, but I'm trying my best. If
Don't know why but I can't find a solution to this. I have 3
don't know better title for this, but here's my code. I have class user
Don't know why but font is not displaying.Please help. CSS(in css folder): style.css: @font-face
Don't know if I worded the question right, but basically what I want to
(Don't know if this is strictly on-topic, but I don't see any better Stack
Don't know how to explain it better but i'm trying to get a response
Don't know if anyone can help me with this or if it's even possible.

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.