- Create a new Xcode command-line project. Name the project Assignment-20-1.
- Add a class to the project named Book.
- Add a few properties that are associated with Books. Make them generic.
- Add a class to the project named CookBook that is a subclass of Book.
- Add a few properties that are just for cookbooks.
- Add a class to the project named TextBook that is a subclass of Book.
- Add a few properties that are just for textbooks.
- Add a method to the Book class named
readBook. In the implementation of the method, output a statement that the book is being read. Something like this.
- Override the
readBook method in both of the subclasses. Have each of the overridden methods output the kind of book they are reading. Like this.
- In the main.m file import all three classes and then perform all the following.
- Create an instance of each of the above classes. Add data to each of them with their setter methods.
- Create an instance of the NSArray class using the three instances of books.
- Using a for in loop, send the
readBook message to each of the books. What type should be in the for in loop?