Hi, this this a part of my code, so i have a problem with "virtual double Add()=0;" function, if i delete it my code works but i need it another class, so how i make it work?
Thanks in advance.
[Error] cannot declare variable 'y' to be of abstract type 'BraucienuskET'
[Error] cannot declare variable 'y1' to be of abstract type 'BraucienuskET'
[Note] virtual double ETalons::Add()
Hello there,
Instead of writing virtual double Add() = 0;
you can use virtual double Add() { return 0; };
depends on what are the use for this function
When you want to instantiate an object of a derived class from an abstract class, you need to ensure that all methods of this abstract class are overridden by non-virtual methods at your derived class. If you forgot this for a method, your derived class remains abstract too.
At your example, BraucienuskET has still the method Add() as pure virtual, so you cannot instantiate objects from. You need to override Add() in your BraucienuskET class.