Working on a project for school and I having this error. I am trying to call a public function of this class. I do not know what to look for to fix this problem. I have checked the spelling. I have also used the "Find references" function in the ide and the ide was able to find the function declaration and definition and call.
What else should I be looking for?
EDIT: Added most of source.cpp did not include all of it due to length restrictions. The header file and implementation file will be included below.
I am actually getting the same error 3 times and those error messages are as follows:
Error C2039 'newAccountRate': is not a member of 'CCdAccount'
Error C2039 'newAccountDuration': is not a member of 'CCdAccount'
Error C2039 'newAccountDeposit': is not a member of 'CCdAccount'
These three errors are all in Source.cpp (which is now in the first post) on lines 207 209 212.
I removed some code for space concerns I don't think what I removed is related.
Just tried to add a cout statement as a placeholder and tried to compile. Still received the same error.
As far as marking functions that do not change member variables. Originally I had the arrays of the class objects passed to the various functions marked as const. I ran into the issue of not knowing the syntax to run some the accessor member functions as const. Is it as simple as [code] const float CCdAccount::getDeposit()[/const]?
I want to get everything working correctly before I go over and make sure that the prompts match what is expected. I copy & pasted portions from previous projects in the class so I am fairly certain that there are prompt errors as a result.
I copy & pasted portions from previous projects in the class so I am fairly certain that there are prompt errors as a result.
Did you copy and paste into the header file? I've seen this "function is not a member of class" error come up where a starting framework for a class was copied from one source to a different computer, and new functions then added in - the compiler didn't recognize the new functions.
It looked fine in Visual Studio, but when copied into a text editor there was a definite difference between the older code and newer code (line break and then different indentation IIRC). Creating a new header file, retyping the same code (no cut and paste), and replacing the old header with new header in the project worked in that case.
The three functions I am having problems with were not were not copy and pasted. I typed the declaration into the header file then had VS create the definition for me.
When I get back to my computer later I will delete every thing (the 3 problem functions) and try again. If the dose t work I will install another ide and try it there.
I ended up fixing the problem by saving my source and header files. Deleting the project and starting a new one then pulling in the files again.
After I did all that I saw that the 3 functions I was having problems with were not saved in the files i saved, despite showing up in Visual Studio when I opened the project.