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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T17:04:44+00:00 2026-06-05T17:04:44+00:00

I have a class Bar: class Bar { public: Bar(void); ~Bar(void); }; And a

  • 0

I have a class Bar:

class Bar
{
public:
Bar(void);
~Bar(void);
};

And a class Foo that gets a reference to Bar object as a constructor parameter and needs to save it in a private member bar_ :

class Foo
{
private:

Bar& bar_;
public:
Foo(Bar& bar) : bar_(bar) {}
~Foo(void) {}
};

This doesn’t compile :

overloaded member function not found in ‘Foo’

missing type specifier – int assumed. Note: C++ does not support default-int

Now i suspect couple of things that i need to assure, the second error is for Bar& bar_; declaration in Foo. Do i need to use an explicit constructor when declaring bar_ ?

I am interested in learning how the compiler works regarding this matter, so a detailed explanation would be highly appreciated.

Thanks.

EDIT

Okay I am posting a new code, since apparently there was nothing wrong with my code.
Parser.h:

#pragma once
class Parser
{
private:
std::istream& inputStream_;
Analyzer& analyzer_;
public:
Parser(std::istream &inputStream, Analyzer& analyzer);
~Parser(void);
};

Parser.cpp :

#include "stdafx.h"
#include "Parser.h"
#include "Analyzer.h"
Parser::Parser(std::istream &inputStream, Analyzer& analyzer ) : inputStream_(inputStream),     analyzer_(analyzer) {}

Parser::~Parser(void) {}

Analyzer.h :

 #pragma once
class Analyzer
{
public:
    Analyzer(void);
    ~Analyzer(void);
};
  • 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-05T17:04:46+00:00Added an answer on June 5, 2026 at 5:04 pm

    This doesn’t compile :

    overloaded member function not found in 'Foo'    
    missing type specifier - int assumed. Note: C++ does not support default-int
    

    The code snippet you provided does indeed compile. I can tell you a little bit about these errors though.

    The first error message happens when you compile a method that has the same name but a different signature from methods declared with the same name in your class. For example, if you had:

    class A {
    public:
        int foo (int);
    };
    
    int A::foo () { return 0; }
    

    The compiler will issue an error about not finding an overloaded member function. The compiler thinks foo is overloaded, because foo(void) is different from foo(int).

    The second error happens when you define a variable or function without a type. This is usually not the actual problem, but a consequence of some other problem. For example, if your code tried to use a class before it was declared, like:

    B b;
    class B {};
    

    You would get the second error about missing type specifier, but it is talking about B on the first line.

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

Sidebar

Related Questions

If I have the following code: public class Foo { public void Bar() {
I have a class that implements IDisposable public class Foo: IDisposable { public void
Assume we have legacy classes, that can't be modified: class Foo { public void
Suppose I have: class Foo { ... }; class Bar : public Foo {
Suppose I have: class Foo { public String Bar { get; set; } }
I have the following piece of code: class Foo { public Foo() { Bar
Concerning data binding I have these classes: public class Foo : List<Bar> { public
I have a class Foo that uses another class Bar to do some stuff.
Suppose I have the following class: public class Foo { private List<Integer> list =
Assume I have a class like this: public class Foo { public Bar RequiredProperty

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.