Chapter 5 : Object Oriented Programming with Objective-C

This forum contains all the assignments and questions readers may have for each chapter.

Moderator: gary.bennett

Chapter 5 : Object Oriented Programming with Objective-C

Postby gary.bennett » Sat Aug 14, 2010 3:32 pm

Object Oriented Programming with Objective-C
Topics:
    The Object
    What Is a Class
    Planning Classes
    Inheritance
    Why Use OOP?
    Eliminate Redundant Code
    Ease of Debugging
    Ease of Replacement
    Advanced Topics
    Interface
    Polymorphism

Weekly Q&A for Objective-C for Absolute Beginners Book

Purpose: Answer questions about Objective-C and OOP from book or other related info.
This Webinar is held every week on Wednesday, from:
6:30 PM - 7:30 PM PST
Register Now at:
https://www2.gotomeeting.com/register/763610930
Once registered you will receive an email confirming your registration with information you need to join the Webinar.
System Requirements
PC-based attendees
Required: Windows® 7, Vista, XP or 2003 Server
Macintosh®-based attendees
Required: Mac OS® X 10.4.11 (Tiger®) or newer
User avatar
gary.bennett
 
Posts: 564
Joined: Thu Feb 26, 2009 3:12 pm

Re: Chapter 5 : Object Oriented Programming with Objective-C

Postby hashman27 » Wed Dec 28, 2011 7:53 pm

Hi, I'm brand new to programming, so apologies in advance for any silly questions/mistakes etc.

I just worked through Chapter 5 of the book (second edition) and tried the exercises at the end.

I'm able to do the first two exercises, but creating a superclass has got me stumped. Here are the steps I took to create a superclass:

- Firstly, I created a Books class.

- Then I went to the Books.h file and added all the properties.

- Then I highlighted 'Books' (after where it says @interface) and clicked Edit > Refactor > Create Superclass.

- I named the superclass of Books as 'PrintedMaterials', selected the upper option ('Create files for new superclass'), and clicked Preview.

- In the leftmost pane of the preview, a yellow warning sign was present. It stated that 'Import statement may need to be changed to reflect actual location of superclass declaration.'

- I clicked save and the PrintedMaterials .h and .m files were present.

- However, in the header file, there was a red error at line 9. Line 9 reads as: #import "NSObject.h

- The error said that 'NSObject.h file is not found'.

So, I have two questions: how do I fix this error and how do I add other classes to this superclass? Any help would be greatly appreciated. Thanks.
hashman27
 
Posts: 0
Joined: Wed Dec 28, 2011 11:21 am

Re: Chapter 5 : Object Oriented Programming with Objective-C

Postby mark.thornbury » Wed Jun 20, 2012 10:40 am

Hi There...

I'm trying the exercise to build a Sales class, and do not understand which class (NSArray, NSString, etc) to use for the three methods ( Charge Credit Card, Print Invoice, Checkout). Any Thoughts? Would the use of -(void) work fine for now?
mark.thornbury
 
Posts: 1
Joined: Thu Feb 09, 2012 3:21 pm
Location: California

Re: Chapter 5 : Object Oriented Programming with Objective-C

Postby Elro » Sat Jul 07, 2012 4:37 am

Hi Gary, 1st off many thanks for the great book and uTube videos that accompany them. My last attempt at any type of programming was GWbasic, so this is a big jump for me. I am loving the content of the book especially with the accompanying videos to help you through.

My question is I have hit chapter 5 and cannot seem to find the corresponding video on uTube, the steps on building the number game in Alice seem to be alluding me.. have I just missed the clip or is it intended as a full student only tutorial?


Once again thanks for the great content - look forward to hearing from you.
Elro
 
Posts: 0
Joined: Fri Jun 22, 2012 5:43 am

Re: Chapter 5 : Object Oriented Programming with Objective-C

Postby gary.bennett » Mon Jul 09, 2012 1:17 pm

Elro wrote:Hi Gary, 1st off many thanks for the great book and uTube videos that accompany them. My last attempt at any type of programming was GWbasic, so this is a big jump for me. I am loving the content of the book especially with the accompanying videos to help you through.

My question is I have hit chapter 5 and cannot seem to find the corresponding video on uTube, the steps on building the number game in Alice seem to be alluding me.. have I just missed the clip or is it intended as a full student only tutorial?


Once again thanks for the great content - look forward to hearing from you.


Hi, Can you join us live in class tonight? I can help you with it.
Gary
User avatar
gary.bennett
 
Posts: 564
Joined: Thu Feb 26, 2009 3:12 pm

Re: Chapter 5 : Object Oriented Programming with Objective-C

Postby Elro » Tue Jul 10, 2012 8:28 am

Afraid the time difference will be a burden for that, I am in GMT +2. Puts me at almost the opposite side of the clock, but would have loved to.
Elro
 
Posts: 0
Joined: Fri Jun 22, 2012 5:43 am

Re: Chapter 5 : Object Oriented Programming with Objective-C

Postby gary.bennett » Tue Jul 10, 2012 10:06 am

Elro wrote:Afraid the time difference will be a burden for that, I am in GMT +2. Puts me at almost the opposite side of the clock, but would have loved to.


Can you email me some times and days that would work for you to discuss via Skype?
Gary
User avatar
gary.bennett
 
Posts: 564
Joined: Thu Feb 26, 2009 3:12 pm

Re: Chapter 5 : Object Oriented Programming with Objective-C

Postby Elro » Sat Jul 14, 2012 1:38 am

This is very kind thanks Gary. I'm going to give it a few tries again myself and i'll be in touch if I am still stuck.

Fantastic support - thanks again.
Elro
 
Posts: 0
Joined: Fri Jun 22, 2012 5:43 am

Re: Chapter 5 : Object Oriented Programming with Objective-C

Postby Geezer » Sun Nov 03, 2013 3:55 pm

I am attempting to learn objective-c using your book and currently stuck on Chapter 5, the final exercise for the daring and advanced. I need assistance on how to create the superclass PrintedMaterials, etc.
Geezer
 
Posts: 0
Joined: Fri Apr 12, 2013 9:08 am


Return to Book -> Objective-C for Absolute Beginners: (2nd Edition) iPhone and Mac Programming Made Easy

cron