473,387 Members | 3,787 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

An error during code:error C2259:

Hi everybody;
During my coding, I have encountered a problem.I appreciate if anybody answer it.

Here is the simplified code:
//Header5.h
#pragma once
#include <string>

using namespace std;

class Parameter {
protected:
int attribute;
public:
virtual Parameter* operator+(Parameter* a)=0;
};

class MyInteger: public Parameter{

public:
//constructors
MyInteger(void);
MyInteger(int incoming);

//functions
MyInteger* operator+(MyInteger* a);

};
class SpecialType: public Parameter{

public:
//Constructors
SpecialType(void);
SpecialType(int incoming);

//Functions
SpecialType* operator+(SpecialType* a);

};

//Source5.cpp
#include "Header5.h"
#include <stdlib.h>
#include <iostream>
#include <string>
#define THE_LAST -1;

using namespace std;

//Constructors of MyInteger
MyInteger::MyInteger(void){

this->attribute = 0;
}
MyInteger::MyInteger(int incoming){

this->attribute = incoming;
}

//function of MyInteger

MyInteger* MyInteger::operator +(MyInteger* a){

MyInteger result; //Here is the bad line.
result.attribute = (this->attribute) + (a->attribute);
return &result;
}
//Constructors of SpecialType
SpecialType::SpecialType(void){

this->attribute = 0;
}
SpecialType::SpecialType(int incoming){

this->attribute = incoming;
}

//function of SpecialType
SpecialType* SpecialType::operator +(SpecialType* a){

//Buralarda hep operator overloading olacak.
SpecialType result;
result.attribute = (this->attribute) - (a->attribute);
return &result;
}
int main(int argc, char**argp){

MyInteger a;
SpecialType b;

return 4;
}

Here are the definition of error:
error C2259: 'MyInteger' : cannot instantiate abstract class
due to following members:

thanks in advance!
Oct 12 '08 #1
1 2421
newb16
687 512MB
virtual Parameter* operator+(Parameter* a)=0;

Here are the definition of error:
error C2259: 'MyInteger' : cannot instantiate abstract class
due to following members:
There were one more line in the error message after colon that you decided to skip, i.e.
due to following members:
virtual Parameter* operator+(Parameter* a)=0;

You need to define function
operator+(Parameter* a) in MyInteger class,
not operator+(MyInteger* a);
Oct 12 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Timh Bergström | last post by:
Hi all! Can i do a global "on error" statement for all forms and modules instead of having "on error goto ErrHand" in each sub/function? The error should be catched to another form there the...
7
by: Spacen Jasset | last post by:
The main two desirable things I feel error handling should provide are these: 1) Debugging and diagnostic aid 2) User feedback One method that is used a fair amount it to 'say' that all...
1
by: Oscar Thornell | last post by:
Hi, I have an ASP.NET page that generates an Exception... The Exception is not caught in the executing method...so it propagates to..the Page_Error event handling method.. In that method the...
7
by: pemo | last post by:
This function of javascript is producing errors function CSIEStyl(s) { return document.all.tags("div").style; } On inspection document.all doesn't have a 'tags' hanging off it. The...
1
by: TSalm | last post by:
Hi, After sending a request, I would get the possible error message. Not the code @@error, nor the exact content of sysmessages, but the message like it could be in the log file. TIA, TSalm
0
by: arial | last post by:
Hi all, I am getting this error message while try to compile my application. I am using visual studio 2003 and crystal report 9.1.5000. I have some old application which is running fine but...
6
by: muddasirmunir | last post by:
hello i had made a project and now i am in deep trouble reagarding this and not finding why this is accuring basically i use vb6 and sqlserver 2000 now my project is working properly for few...
6
by: lily86 | last post by:
i'm using vs.net 2003.... i want to let the user upload images and i want to save the image to my web server file to convenient i display the images on other pages.... but i'm having a problem when i...
0
by: vagueante | last post by:
Hi, I have a windows service that i connecto to a iSeries Dataqueue, i can write and read from it. The purpose of this service it's to keep reading the dataqueue and when it has some data i run...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.