Amazon.com Widgets Exercise 10 question
Welcome, Guest. Please login or register.
Did you miss your activation email?
July 28, 2014, 07:22:23 AM
Home Help Search chat Login Register 
News: Read this please.The Great Kangaroo Escape Looking for reviews of the 4th ed on Amazon!   Twitter:  @skochan
                     

+ Official Forum for Programming in Objective-C (the iPhone Programming Language) - Stephen Kochan
|-+ Old Stuff
| |-+ Chapter Study
| | |-+ Chapter 4 - Data Types and Expressions
| | | |-+ Exercise 10 question
Pages: [1] Go Down
Print
Author Topic: Exercise 10 question (Read 717 times)
Vicarious
Newbie
*
Posts: 9






on: November 26, 2011, 08:59:15 AM

I finally located some working code for Exercise 10, which someone had posted (sorry, can't recall the user name), and discovered that the principle error in my own code was creating a setMemory method, and once I'd removed that method, everything else (more or less) fell into place, and most of the other errors disappeared. But it left me with a few questions:

1) why does creating that method cause the "previous declaration of (double) memoryClear" error?

2) In my mind, a memory function in a calculator is simply another accumulator. Why, then, don't I have to create a setMemory method in the same manner as having to create a setAccumulator method? And, furthermore, what is the purpose of the setAccumulator method? How is it different than a setMemory method?

Thanks again.
Logged
Fred
Newbie
*
Posts: 46






Reply #1 on: November 29, 2011, 09:32:09 AM

Vicarious,

Without seeing the code it would be just a guess at what is happening.  Adding another method in itself should not cause any problems, it is most likely the code in the method that is causing the problem.  The error you mention implies you've declared the memoryClear method more than once, which will cause an error.  Each method should be declared only once within a class.

Looking at examples as you have done is a good way to see what works and eventually figuring out why.

Fred
Logged

Fred
Pages: [1] Go Up
Print
Jump to:



Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Entire forum contents (c) 2009 classroomM.com. All rights reserved.