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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:50:27+00:00 2026-06-14T07:50:27+00:00

I have a Track class with a multimap member that contains Note objects. One

  • 0

I have a Track class with a multimap member that contains Note objects. One of the methods of the Note class is this:

float Note::getValue(){
    float sample = generator->getSample(this); // not working
    return sample;
}

Note also has a member of Generator type and I need to call the getSample method of that class, which expects a Note as argument. I need to pass the current Note object and tried doing so with the keyword this but that’s not working and giving me the error Non-const lvalue reference to type 'Note' cannot bind to a temporary of type 'Note *'.

This is what the method definition for getSample looks like:

virtual float getSample(Note &note);

As you can see I’m using a reference because this method is called very very often and I can’t afford to copy the object. So my question is: any ideas how I can get this done? Or maybe change my model to something that could work?

EDIT

I forgot to mention that I also had tried using generator->getSample(*this); but this wasn’t working either. I’m getting this error message:

Undefined symbols for architecture i386:
  "typeinfo for Generator", referenced from:
      typeinfo for Synth in Synth.o
  "vtable for Generator", referenced from:
      Generator::Generator(Generator const&) in InstrumentGridViewController.o
      Generator::Generator() in Synth.o
      Generator::Generator(Generator const&) in InstrumentGridViewController.o
      Generator::Generator() in Synth.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

This is what my Generator class looks like (the getSample method is implemented in a subclass):

class Generator{
public:
    virtual float getSample(Note &note);

};
  • 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-14T07:50:29+00:00Added an answer on June 14, 2026 at 7:50 am

    You must declare your Generator class as abstract, try this declaration:

    virtual float getSample(Note &note)=0; 
    //this will force all derived classes to implement it
    

    But if you dont need it you must implement virtual function in base class anyway:

    virtual float getSample(Note &note){}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a class where the instances of this class needs to track the
I have a class MyImage, that have a NSAffineTransform member transform. In my AppDelegate
I have a class that extends TreeNode in .NET 3.5 (C#), LocationNode . This
In a web-crawler of mine, I have a class that keeps track of urls
I have a Playlist class that has a vector with Tracks and each Track
I have created a singleton class to keep track of my data on my
I have a table that I keep track of fees for a specific item.
To track revisions of a Page class, I have a PageRevision class which inherits
I have data from a CD or Record currently setup like this: class Release
So I have a java class that takes individual commands and puts them into

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.