Undeclared Identifier - Part 2

Posted on 1998-03-17
Last Modified: 2010-04-10
Okay the last one was a stupid spelling oversight. But I can't see why I get a "undeclared identifier" error everytime  I use the instance of the class as an arguement. The code snippet follows:

class CIntegerSet
CIntegerSet (int,int,int,int,int);
CIntegerSet ();
void UnionOfIntegerSets                         (CIntegerSet &, CIntegerSet &);
CIntegerSet IntersectionOfIntegerSet (CIntegerSet &, CIntegerSet &);
void InsertElement (CIntegerSet &, int);
void DeleteElement (CIntegerSet &, int);
void SetPrint         (CIntegerSet &);
bool IsEqual         (CIntegerSet &, CIntegerSet &);
      int IntArray[100];

int main ()

CIntegerSet IntSet1(4, 9, 21, 13, 44);
CIntegerSet IntSet2(3, 7, 33, 62, 75);
CIntegerSet IntSet3();

UnionOfIntegerSets(IntSet1, IntSet2);  // error HERE

SetPrint(IntSet3); //error HERE

InsertElement(IntSet1, 15);  //error HERE
InsertElement(IntSet2, 15);   // funny, no error here
Question by:dpms

Accepted Solution

vsinha earned 50 total points
ID: 1183572
Whenever you call a method, you should first write the name of the associated class, followed by a '.', followed by the method name.

From what you have done I think you want to do the following:

class CIntegerSet
   void InsertElement (int);
   void DeleteElement (int);
   void SetPrint    ();

   int main ()

   CIntegerSet IntSet1(4, 9, 21, 13, 44);
   CIntegerSet IntSet2(3, 7, 33, 62, 75);
   CIntegerSet IntSet3();




I would suggest you to look at an example, before going further. I can find a good example on a matrix class if you are interested.


Expert Comment

ID: 1183573
The compiler is also going to bark about your constructor...  
Once you fix your other compile errors your constructor is going to cause an error.
CIntegerSet (int,int,int,int,int); This will produce an unresolved identifer LNK 1120 error..

Above is how you declare it....  Needs to be declared like this
CIntegerSet (int,int,int,int,int) {};

Plus you might actually want to do something in the constructor also...



Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Losing latter half of command line in Visual Studio C++ online program 10 88
FMX StringGrid1->Canvas->FillRect Problem 3 197
Unresolved External Symbols 3 130
learn programming 8 69
When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question