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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:34:14+00:00 2026-06-18T03:34:14+00:00

I have been working on this project and I am very close to complete

  • 0

I have been working on this project and I am very close to complete but have one issue with functions saying they are overloaded – any hints would be amazing! Here is my code:

#include <iostream>
#include <fstream>
#include <string.h>
#include <algorithm>
#include <string>
using namespace std;

class OpAmps 
{
private:
  string Name;
  unsigned int PinCount; 
  double SlewRate; 
public:
  void Enter();
  void Save();
  void Load();
  void Sort();
  void Display();

  friend bool SortName(const OpAmps &, const OpAmps &);
  friend bool SortSlewRate(const OpAmps &, const OpAmps &);
};

#define DATABASE_MAX 10
#define DATABASE_FILENAME "database.txt"

int main()
{
  OpAmps OpAmp[DATABASE_MAX]; 
  OpAmps Menu;
  unsigned long database_length = 0; 
  char UserInput;
while (1) 
{
    cout << endl;
    cout << "Op-amp database menu" << endl;
    cout << "--------------------" << endl;
    cout << "1. Enter a new op-amp into the database" << endl;
    cout << "2. Save the database to disk" << endl;
    cout << "3. Load the database from disk" << endl;
    cout << "4. Sort the database" << endl;
    cout << "5. Display the database" << endl;
    cout << "6. Exit from the program" << endl << endl;
    cout << "Enter your option: ";

    cin >> UserInput;

    cout << endl;

    switch(UserInput) 
    {
        case '1':
        Menu.Enter();
        break;

        case '2':
        Menu.Save();
        break;

        case '3':
        Menu.Load();
        break;

        case '4':
        Menu.Sort();
        break;

        case '5':
        Menu.Display();
        break;

        case '6':
        return 0;

        default:
        cout << "Invalid entry" << endl << endl;
        break;
    }
}
}

void OpAmps::Enter(OpAmps& Op, unsigned long& database_length)
{
if (database_length == DATABASE_MAX) 
{
    cout << "The database is full" << endl;
}
else 
{
    cout << "Add new data" << endl;
    cout << "------------" << endl;
    cout << "Enter op-amp name: ";
    cin >> Op.Name;
    cout << "Enter number of pins: ";
    cin >> Op.PinCount;
    cout << "Enter slew rate: ";
    cin >> Op.SlewRate;
    cout << endl;
    database_length++;
}
}

void OpAmps::Save(const OpAmps* Op, unsigned long database_length)
{
fstream output_file;
output_file.open(DATABASE_FILENAME, ios::out);
if(output_file.good()) 
{
    output_file << database_length << endl << endl;
    for (unsigned long i=0;i<database_length;i++) 
    {
        output_file << Op[i].Name << endl;
        output_file << Op[i].PinCount << endl;
        output_file << Op[i].SlewRate << endl << endl;
    }
}
output_file.close();
}

void OpAmps::Load(OpAmps* Op, unsigned long& database_length)
{
fstream input_file; 
input_file.open(DATABASE_FILENAME, ios::in);
if(input_file.good()) 
{
    input_file >> database_length;
    for (unsigned long i=0;i<database_length;i++) 
    {
        input_file >> Op[i].Name;
        input_file >> Op[i].PinCount;
        input_file >> Op[i].SlewRate;
    }
}
input_file.close();
}

void OpAmps::Sort(OpAmps* Op, unsigned long database_length)
{
char UserInput;
cout << endl;
cout << "Sorting options" << endl;
cout << "---------------" << endl;
cout << "1. To sort by name" << endl;
cout << "2. To sort by slew rate" << endl;
cout << "3. No sorting" << endl << endl;
cout << "Enter your option: ";
cin >> UserInput;
cout << endl;
switch(UserInput) 
{
    case '1':
    cout<<"sortName"<<endl;
    std::sort(Op, Op + database_length, SortName);
    break;

    case '2':
    cout<<"sortslew"<<endl;
    std::sort(Op,Op + database_length, SortSlewRate);
    break;

    case '3':
    return;
    default:
    cout << "Invalid entry" << endl << endl;
    break;
}
}

bool SortName(const OpAmps &First, const OpAmps &Second)
{
  return First.Name < Second.Name;
}

bool SortSlewRate (const OpAmps &First, const OpAmps &Second)
{
  return First.SlewRate < Second.SlewRate;
}

void OpAmps::Display(const OpAmps* Op, unsigned long database_length)
{
if (database_length == 0) 
{
    cout << "No elements in the database" << endl;
}
else 
{
    cout << endl;
    for (unsigned long i=0;i<database_length;i++) 
    {
        cout << "Name: " << Op[i].Name <<endl;
        cout << "Number of Pins: " << Op[i].PinCount << endl;
        cout << "Slew Rate: " << Op[i].SlewRate << endl;
        cout << endl;
    }
}
}

The errors I am getting are:

error C2511: 'void OpAmps::Enter(OpAmps &,unsigned long &)' : overloaded member     function not found in 'OpAmps'

see declaration of 'OpAmps'

error C2511: 'void OpAmps::Save(const OpAmps *,unsigned long)' : overloaded member function not found in 'OpAmps'

see declaration of 'OpAmps'

error C2511: 'void OpAmps::Load(OpAmps *,unsigned long &)' : overloaded member function not found in 'OpAmps'

see declaration of 'OpAmps'

error C2511: 'void OpAmps::Sort(OpAmps *,unsigned long)' : overloaded member function not found in 'OpAmps'

see declaration of 'OpAmps'

error C2511: 'void OpAmps::Display(const OpAmps *,unsigned long)' : overloaded member function not found in 'OpAmps'

see declaration of 'OpAmps'

Any help would be amazing!!
Thanks xx

  • 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-18T03:34:15+00:00Added an answer on June 18, 2026 at 3:34 am

    You prototype this function:

    void Enter();
    

    And then you implemented it as:

    void OpAmps::Enter(OpAmps& Op, unsigned long& database_length)
    

    Which doesn’t make sense in the slightest.

    Either change the signature, or the implementation, and I think that in this case you’d be better off changing the signature.

    But even then, I don’t think the first OpAmps& parameter in the implementation is necessary. You should use this. So change the method prototype into:

    void Enter(unsigned long&);
    

    And the implementation into:

    void OpAmps::Enter(unsigned long& database_length)
    

    And change any use of the unnecessary op parameter with the this keyword. The same holds for any OpAmps::? function you’re not prototyping/implementing correctly.

    The reason for this is because the functions you’re declaring are non-static member functions, meaning they always belong to an instance. You don’t need to pass the instance to the method like you would in C, instead you can use the instance the method is called on to with the this keyword. The this keyword is a constant pointer to the instance the method is called on (in your case that would be a pointer to Menu).

    You could therefore use:

    cin >> this->Name;
    

    Instead of:

    cin >> op.Name;
    

    However, in this case, it’s unnecessary to use the this keyword. The C++ will figure out itself whether the field/function is instance-bound or not:

    cin >> Name;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello I have been working on this project for a while and am very
i have been working on this text extraction project of various file extensions, but
I have been working on one project which is too complex and contain very
So I have been working on this project for a short while now. I
Have been working on this question for a couple hours and have come close
I have been working on this for days but I don't get it so
I have been working on a project in scala, but I am getting some
I have been working on this project and recently got stuck. Basically lets say
I've been working on this Haskell project, and I have a cabal file for
I have been working on this project on Java with multiple modules. Since quite

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.