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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T14:27:58+00:00 2026-06-03T14:27:58+00:00

I have this abstract base class ODESolver: //ODESolver.h #ifndef ODESolver_H #define ODESolver_H #include doublependulum.h

  • 0

I have this abstract base class ODESolver:

//ODESolver.h
#ifndef ODESolver_H
#define ODESolver_H
#include "doublependulum.h"
class ODESolver
{
public:
    ODESolver( DoublePendulum&);           //constr
    virtual ~ODESolver();                  //destr
    virtual void predict (const double &)=0; //virtual
protected:
    DoublePendulum DoublePend;
};
#endif

with implementation:

//ODESolver.cpp
#include "ODESolver.h"
//constructor
ODESolver::ODESolver( DoublePendulum & param)
          :DoublePend(param)
{}
//destructor
ODESolver::~ODESolver(){}

I also have this class ODEEuler wich inherits from ODESolver

//ODEEuler.h
#ifndef ODEEuler_H
#define ODEEuler_H
#include "ODESolver.h"
class ODEEuler : public ODESolver
{
public:
    ODEEuler(DoublePendulum &);
    virtual ~ODEEuler();     
    virtual void Predict(const double &);
};
#endif

with implementation

//ODEEuler.cpp
#include "ODEEuler.h"
#include <iostream>
using namespace::std;
ODEEuler::ODEEuler (DoublePendulum &param) 
         :ODESolver(param)
{}
//destructor
ODEEuler::~ODEEuler(){}
 void ODEEuler::Predict(const double &dt=0.01)
{
    DoublePend=DoublePend+DoublePend.Derivative()*dt;
    cout << DoublePend.getUp().getTheta() << endl; \\ I want to print getTheta on the screen form my getUp Pendulum from my Doublepend
}

I now want to test my ODEEuler, so I made an object in my Main file:

//Main.cpp
#include "pendulum.h"
#include "doublependulum.h"
#include "ODEEuler.h"
#include "ODESolver.h"
#include <iostream>
using namespace::std;
int main()
{ 
Pendulum MyPendulum(1.5,1.5,1.5,1.5);
DoublePendulum MyDoublePendulum(MyPendulum,MyPendulum,9.81);  
ODEEuler myODEEuler(MyDoublePendulum);
return 0;
}

I keep getting this error:

1>….\main.cpp(24): error C2259: ‘ODEEuler’ : cannot instantiate
abstract class 1> due to following members: 1> ‘void
ODESolver::predict(const double &)’ : is abstract 1>
…..\odesolver.h(11) : see declaration of ‘ODESolver::predict’

I checked if all the types that I used in my virtual void predict function are the same as elsewhere. I guess it is maybe something conceptual I do wrong. What exactly does it mean that I cannont instantiate ,because ‘predict’ is abstract?

Thanks in advance for your support!

  • 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-03T14:28:00+00:00Added an answer on June 3, 2026 at 2:28 pm

    Your derived class needs to implement the pure virtual function to be able to be instantiable.

    virtual void predict (const double &)=0;
                 ^
    
    void ODEEuler::Predict(const double &dt=0.01)
                   ^
    

    Notice the capital p it makes the method in derived class a different method and you end up never defining the Base class pure virtual method.

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

Sidebar

Related Questions

I have an abstract entity base class defined like this: public abstract class SessionItem
I have this Base class: abstract class Base { public int x { get
Let's say I have this base class: abstract public class Base { abstract public
the question is simple. I have a base abstract class (person). From this i
I have a model that looks something like this: public abstract class Parent {
I have an abstract class BaseItem declared like this: public abstract class BaseItem {
I have something link this: public abstract class Wrapper<T, TWrapped>: where TWrapped : Wrapper<T,
I have this base class having the following interface: abstract class Base { abstract
Lets say I have an abstract base class with a pure virtual that returns
Let's say I have an abstract base class that looks like this: class StellarObject(BaseModel):

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.