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

The Archive Base Latest Questions

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

I have an interface called Generator that looks like this: class Generator{ public: virtual

  • 0

I have an interface called Generator that looks like this:

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

And my Synth class is implementing it, like this:

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

float Synth::getSample(Note &note){
    return 0.5;
}

I’m trying to call the getSample method from my Note class (which has a generator member)

class Note : public Playable{
public:
    Generator *generator;
    virtual float getValue();
};

float Note::getValue(){
    float sample = generator->getSample(*this); // gets stuck here
    return sample;
}

When I try to run, it gets stuck on the marked line in the code above. The problem is that I’m not getting a very clear error message. This is what I can see once it stops:

enter image description here
enter image description here

  • 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-13T23:34:19+00:00Added an answer on June 13, 2026 at 11:34 pm

    It seems like you never initialized the member Note::generator, so calling a function on it is undefined behavior.

    Try, as a test:

    float Note::getValue(){
        generator = new Synth;
        float sample = generator->getSample(*this); // gets stuck here
        return sample;
    }
    

    If it works, go back and review your logic. Use a std::unique_ptr<Generator> instead of a raw pointer. Create a constructor for Node. Initialize the pointer there.

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

Sidebar

Related Questions

I have an interface (called Subject ) that has the following method: public void
I have a scene, called testScene, it works like this: @interface testScene : myScene
I have an interface that contains a single method called ListAll() using System.Collections.Generic; namespace
I have interface Foo public interface Foo { public void test(); } Class FooChild
I need your help. I have a C executable called generator.out that is a
So I have an entitytype called SportsWagon and an interface ICar that SportsWagon implements.
Say I have a .NET class like so: public class Person { public string
I have two questions 1) my interface i have interface called IRegister and within
I have a base class called Component. I also have 2 interfaces I2DComponent, and
I have interface IConfigurationSource { .... } and class FileConfigurationSource : IConfigurationSource { FileConfigurationSource(string

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.