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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T19:07:33+00:00 2026-05-10T19:07:33+00:00

If I do this: // In header class Foo { void foo(bar*); }; //

  • 0

If I do this:

// In header  class Foo { void foo(bar*); };  // In cpp void Foo::foo(bar* const pBar) { //Stuff } 

The compiler does not complain that the signatures for Foo::foo do not match. However if I had:

void foo(const bar*); //In header void Foo::foo(bar*) {} //In cpp 

The code will fail to compile.

What is going on? I’m using gcc 4.1.x

  • 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. 2026-05-10T19:07:34+00:00Added an answer on May 10, 2026 at 7:07 pm

    The const keyword in the first example is meaningless. You are saying that you don’t plan on changing the pointer. However, the pointer was passed by value and so it dos not matter if you change it or not; it will not effect the caller. Similarly, you could also do this:

    // In header  class Foo { void foo( int b ); };  // In cpp void Foo::foo( const int b ) { //Stuff } 

    You can even do this:

    // In header  class Foo { void foo( const int b ); };  // In cpp void Foo::foo( int b ) { //Stuff } 

    Since the int is passed by value, the constness does not matter.

    In the second example you are saying that your function takes a pointer to one type, but then implement it as taking a pointer to another type, therefore it fails.

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

Sidebar

Ask A Question

Stats

  • Questions 63k
  • Answers 63k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Have you tried nvarchar(max)? Also, please state which version of… May 11, 2026 at 10:25 am
  • added an answer Phillip, Creating a good lint for xlst is quite hard,… May 11, 2026 at 10:25 am
  • added an answer What you're asking for is a tutorial, which you really… May 11, 2026 at 10:25 am

Related Questions

If I do this: // In header class Foo { void foo(bar*); }; //
In Python, if I do this: print "4" * 4 I get > "4444"
I want to do this in Actionscript: typeof(control1) != typeof(control2) to test if two
I know I can do this foreach (PropertyInfo property in myobject.GetType().GetProperties()) { if (property.DeclaringType.ToString()
Unsure if I've phrased this correctly, but in the callback how do I reference
I'm not sure if this is something I should do in T-SQL or not,
I have an array: data.Dealer.car[0] data.Dealer.car[1] data.Dealer.car[2] If I do this: alert(data.Dealer.car.length); delete data.Dealer.car[1];
If I do something like this: using (SqlCommand cmd = new SqlCommand(SELECT * FROM
Before I do this I figured I would ask if it was the best
If I send this request to a page: http://www.server.com/show.xml?color=red&number=two Can I do something like

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.