Simple question - how to create a superclass?

So I've recently started programming, and I'm using a book to learn. It's the 2nd edition of Objective-C for Absolute Beginners.
Anyway, I'm up to the 5th chapter which deals with classes, and one of the tasks at the end of the chapter is to create a superclass.
The example is of a bookstore. Let's say I make a class called PrintedMaterials (this will be the superclass). Now I want to make some (sub)classes called Books, Newpapers and Magazines, the superclass of which will be PrintedMaterials.
How do I go about doing this? I can make Objective-C classes under NSObject, but I don't know how to make them subclasses of another class.
I have Xcode 4.2 and I'm running Mac OS X 10.7.2.
Thanks.

//  PrintedMaterial.h
//  Created by Michael Superczynski on 1/25/12.
//  Copyright 2012 HyperNova Software. All rights reserved.
@interface PrintedMaterial : NSObject
    BOOL available;
@property BOOL available;
@end
//  PrintedMaterial.m
//  Created by Michael Superczynski on 1/25/12.
//  Copyright 2012 HyperNova Software. All rights reserved.
#import "PrintedMaterial.h"
@implementation PrintedMaterial
@synthesize available;
-(id)init
    self = [super init];
    if (self)
        available = YES;
    return self;
//  Book.h
//  Created by Michael Superczynski on 1/25/12.
//  Copyright 2012 HyperNova Software. All rights reserved.
@interface Book : PrintedMaterial
    NSString *title;
@property (nonatomic, strong) NSString *title;
@end
//  Book.m
//  Created by Michael Superczynski on 1/25/12.
//  Copyright 2012 HyperNova Software. All rights reserved.
#import "Book.h"
#import "PrintedMaterial.h"
@implementation Book
@synthesize title;
-(id)init
    self = [super init];
    if (self)
        title = @"Learning Objective-C";
    return self;
-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    PrintedMaterial *thePrintedMaterial  = [[PrintedMaterial alloc] init];
    Book *book = [[Book alloc]init];
    self.book.title = "Learning Xcode";

Similar Messages

  • A simple question: how to create a folder in the active root

    I have a simple little issue:
    When I go in the "Finder" down the folder chain to what ever place with the intention to create a new sub folder, using "file" + "new folder" the system always create the new folder in the main root versus creating it where I'm standing (highlighted root) in the folder chain.
    Any idea how to make the new folder directly under the highlighted root?
    Thx

    If you are in column view a new folder will be created in the selected folder, but if you are using the other views you need to actually open the folder. The path shown at the top of a Finder window will show the target of the window (which is where a new folder will be created).

  • Simple question - How do you make an onchange event occur in a select list

    Simple question - How do you make an onchange event occur in a select list to fire a process?
    Thanks

    1) Using ApEx Selec list on Submit Item.
    You will create a PL/SQL Process after Submit. -> Conditional Type Request = Expression1. -> Expression1 is the name of your Select List. Process Source - > Procedure you like. For example depending of your select List value you will add rows in different tables.
    2) Javascript This example will change a System parameter value when changed
    <select id="P3_SUBSYSTEM" onchange="location.href='f?p=101:3:2164422329953284::NO::P3_SUBSYSTEM:'+this.options[selectedIndex].value;" size="1" name="p_t21">

  • Very simple question, how do you configure windows 8.1 to use a SF card as the default install location for software applications?

    Very simple question, how do you configure windows 8.1 to use a SD card / external drive as the default install location for software applications? Primarily interested in apps installed from the windows store. This should be available in the settings
    charm within the windows store. This must have been overlooked in the development of windows 8.1 or is a bug.
    Regards, Bill
    * update
    I've tried modifying this key and the path:
    “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Appx”
    http://answers.microsoft.com/en-us/windows/forum/windows_8-windows_store/how-do-you-install-apps-in-windows-8-from-the/c4fbe2a8-fd3d-41c1-b9a6-6f881eed374f
    Also tried using symlinks as detailed here:
    http://social.technet.microsoft.com/Forums/windows/en-US/8eee52c2-db0f-4032-8c72-7cd999e8b41a/windows-8-apps-installing-to-secondary-drive?forum=w8itprogeneral

    Here's some links I've used to try to figure this out:
    http://social.technet.microsoft.com/Forums/windows/en-US/2dfc0cd9-7d1b-41de-abce-e03fb6a5a383/metro-apps-not-working-in-windows-8-pro-x64-after-moving-users-and-programdata-folders?forum=w8itproinstall
    http://social.technet.microsoft.com/Forums/windows/en-US/8eee52c2-db0f-4032-8c72-7cd999e8b41a/windows-8-apps-installing-to-secondary-drive?forum=w8itprogeneral
    http://social.technet.microsoft.com/Forums/windows/de-DE/f5e33ac9-beab-4b99-b3ca-7cb5e6f415e4/how-do-you-change-metro-apps-default-install-location?forum=w8itprogeneral
    Regards, Bill
    The registry method does not work with 8.1.  I found this out the hard way.  Doing it on 8.1 will leave you reinstalling the OS if you didn't do a SRP beforehand.

  • HT4753 I have a very simple question: how do I view where Lion has autosaved my current version to (without the convoluted route of using finder)? In days gone by i'd simply use the save as function to see where it was being saved.

    I have a very simple question: how do I view where Lion has autosaved my current version to (without the convoluted route of using finder)? In days gone by i'd simply use the save as function to see where it was being saved.

    It's actually even easier than using Save As to see the full path to the currently open document. Just do a "Secondary click" on the document title in its window's title bar.
    Like you, I relied upon Save As my whole life to check a file's location and considered it a must-have capability. Turns out it's even faster to use the single-click method to reveal the full path to the open document. It displays the entire path to the current document starting from the level of your Mac, and works for files stored on drives as well as iCloud.
    If you're not sure how to do a secondary click, go into System Preferences, select Trackpad, Point & Click to find the current preference for secondary click on your Mac. If you happen to have a mouse with more than one button, it's probably the right button. As a trackpad user, I check the box to "Click or tap with two fingers," so a simple two finger tap on the title of an open document reveals its full path. This feature actually has been around for a very long time.
    Note that this is not the same thing as the Autosave and Versions menu, which is exposed using a little drop down triangle to the right of the title. There is no visual clue for the presence of this feature - you just have to know it's there, probably because this feature goes all the way back to pre-OS X days.

  • New comer ask 2 simple questions:how to set the use of the right click of

    New comer ask 2 simple questions:how to set the use of the right click of your mouse?
    I don't know why when i click the right button of my mouse in logic, sometimes it's the same funcion as my left one, some times it's the same function that opens the tool menu....But in MacOSX,it's all okay.Just the weired thing in logic ,please help
    2.is there any kind of filter in Score? I mean, in midi track I have a C1 note, and I don't want the C1 note shown in my score, I want every note show which are above C2, like a filter. I think this is helpful dealling with some keyswich things,how can we do that?

    In Preferences -> Global -> Editing you can choose weather right click is assignable or opens the tools box.
    Not to sure about the score dude

  • Very simple question-how to fill a shape I draw with color

    hi. I am new to photoshop and having a lot of trouble selecting any shape that I draw. I am trying to do a tutorial that involves filling a canvas with gray, then drawing a smaller white rectangle inside of the larger gray canvas/rectangle. (I did not forget to unlock the background).
    My question: how do i select and fill (with white) the second rectangle I draw on top of the larger gray rectangle???
    In general, I cannot figure out how to select and/or fill any shape I draw using the rectangle tool. Likewise, the marque shape tools are no help as I cannot seem to draw a marque on my gray rectangle in order to select it and fill it with a white fill. I have also tried to use a "fill layer."
    I am almost certain that something is wrong with my computer(I reset the settings), but then again I have not used photoshop in over a year. Any help  will be greatly appreciated.

    The Rectangle Tool sgould create a Work Path, Shape Layer or Fill Pixels according to the Settings in the Options Bar.
    The Rectangular Marquee Tool should create a Selection, which you could Edit > Fill or use as a Layer Mask for a Solid Color Layer.
    Could you please post a screenshot with the pertinent Panels visible?

  • Simple Question: How to search for a date value in SELECT

    Probabily a simple question, but in a SELECT statement, how do you do a search for a date value in the WHERE clause?
    example:
    Select * From Example
    Where date = 01/01/2001
    I know its not as simple as that, but what change has to occur to make it do what that example implies?
    Thanks In Advance.

    If you want to avoid the conversion part(to_date) you will need to specify the date in the format as ur nls date format.so the same query might not work if you change ur nls date format.
    so it is advisable to give it in general format.
    ie where date_col=to_date(01-01-2000,'dd-mm-yyyy')

  • Simple Question - How do I deploy custom taglibs to Oracle 9iAS r2?

    Simple question.
    There are lots of simple examples on JSP custom tags that have
    a .tld file, a .java file with the handler class, and a .jsp
    file that calls the custom tag to test it.
    My question is, lets say I have a .tld file, a .java file and
    a .jsp file for a tag example. How do I deploy them to
    Oracle 9iAS r2? I'd like to code an example and deploy it,
    but I'm stuck. I'm using Jdeveloper 9i, and have compiled the
    .java file and included it and the .tld in a Custom Taglib JAR.
    How is this JAR deployed to Oracle 9iAS, considering that the
    Enterprise Manager only deploys WAR and EAR files? How do
    a configure a web app to use the custom tags...
    This should be simple -- maybe its too simple so I'm stuck!

    check out ojspdemos which comes with the product.
    Also see
    http://otn.oracle.com/tech/java/oc4j/doc_library/902/jsp/taglibs.htm#1004903
    -Prasad

  • Basic question, how to create rtf template with a given xml file

    Hello guys
    I am new to BI publisher and I am learning how to create rtf templates using given xml fiel definitions by following the bi publisher guide
    The steps I am following is:
    1, create template using template builders, which is downloaded into MS words.
    2, In the empty template, map the xml columns with template field using BI publisher tag
    3, upload the template to BI Publisher as a layout.
    That's all I can understand.
    My question is:
    1,in which above step do I import XML file into template builder (if not bi publisher), how to do so?
    2,After template is created, how to associate this template layout with existing reports in BI Publisher, or is it necessary at all?
    3,In the template content in MS Word template builder, what should I enter other than BI publisher tags for mapping XML field to desired template field
    Or, if my understand of this process is entirely wrong, what's the right process of creating rtf template with a given XML file definition
    Thanks

    If you have a BI Publisher desktop installed, have a look a the demos,.. should answer most of your basic questions.
    (Windows) Start->Programs->Oracle BI Publisher Desktop->Demos
    Invoice Demo - good one for those with E-Business Suite
    Report Demo - Sample using BI Publisher

  • Simple question - How to find date

    Hi Experts,
    I have a simple question on date. Suppose today is Jan 4, 2010. I have to find out Jan 1, 2007 using Java code.
    I have used following code. This code will work for 2010 and 2011 properly. However it won't work properly after Feb 28, 2012. Please see "dayInMillis*1096 " portion of code. Here 365365366 = 1096.
    How I can avoid this hard coding. Do we have any simple way to get Jan 1, 2007 even without using following code.
         Calendar calendar = Calendar.getInstance();
         int lastDate = calendar.getActualMaximum(Calendar.DATE);
         int firstDate = calendar.getActualMinimum(Calendar.DATE);
         int todayDate = calendar.get(Calendar.DATE);
         int dayofyear = calendar.get(Calendar.DAY_OF_YEAR);
         java.sql.Date currentdate = new java.sql.Date(System.currentTimeMillis());
         long dayInMillis = 1000 * 60 * 60 *24; //1 day
         wdContext.currentContextElement().setFromDate(new Date(System.currentTimeMillis() - dayInMillis*1096 - ((dayofyear-1)*dayInMillis)));
    Please help.
    Regards,
    Gary

    Hi Gary,
    I am not pretty much clear with your question, whatever i have understood, i have found a way to get the previous date given the current date.
    Below is the code for the same.
                           Calendar now = Calendar.getInstance();//Jan 4, 2010
           String nowDateStr = DateFormat.getDateInstance().format(now.getTime());
           System.out.println("date now : " +nowDateStr);
           now.add(Calendar.YEAR, -3);//2007
           now.add(Calendar.DATE, -3);//1st
           now.add(Calendar.MONTH, 0);//No change in month, Jan.
           String changedDateStr = DateFormat.getDateInstance().format(now.getTime());
           System.out.println("date changed : " +changedDateStr);

  • Beginner question:  How to create a duplicate

    Sorry to ask such a basic question .. I'm a beginner!  Can't seem to find out how to create an exact duplicate of a photo I have finished editing ... so I can create a black & white version ... can someone help?

    You are welcome, welcome..... ........The nicest and fastest reply in some time!
    There are a ton of tutorials available online, and if you have any trouble finding same, post back and recommendations will be made.

  • Question: How to create new user and schema in 11g?

    Who can give me answer how to create a new user and schedule?
    I had installed oracle 11g DB and oracle client in my windows OS. I found in the 11g there is no enterprise manager console with new version. It is different from with oracle 10g.So i don't know how to create it new user.
    I had created new DB instance, but i don't how to create a user on that. Who can give me a hand for that? I hope one oracle experenice expert give my answers.
    Thanks a lot!
    Edited by: user774630 on Oct 27, 2008 10:01 PM
    Edited by: user774630 on Oct 27, 2008 10:09 PM

    Hi,
    I am not sure that which option you are talking about? Are you using the EMCA,http://download.oracle.com/docs/cd/B28359_01/server.111/b28319/emca.htm#SUTIL800] to create the new repository for the EM? If not the command line than the other only way is to use DBCA(Database Configuration Assistant).I believe you are talking about that. Yes ,if the message is coming creating the repository than after wards you can login to the EM. You would get the port no of the EM's HTTP port from the $OH/install/portlist.ini file.
    HTH
    Aman....
    Edited by: Aman.... on Oct 28, 2008 11:36 AM
    Gave up, link insertion doesn't work.

  • Newbie question: How to create a namespace and record filedate-retrieve

    Spanking new to Namespaces
    Looking for a way to place a .jpg as a smart object, then using Namespace, record the filedate of the .jpg
    Then, have the layer sense if the original .jpg is newer and change the color of the layer.
    Running into complications trying to do this with .jsx scripting alone.
    Reason: This way, if the .jpg has been updated on the file server, the artist will be able to easily see that.
    Don't want to add a panel and more work for the artist. Rather, have it all happen behind the scenes.

    Here is how I create a new namespace in the layer metadata for my panel
    // new namespace. Even though it looks like a web url it's not. It just needs to be unique.
    const ns= 'http://www.smartobjectlinks.com/1.0/';
    function setSOLinkMetadata( property, value ){
         if( activeDocument.activeLayer.isBackgroundLayer || !loadXMPLibrary()){
              alert( ErrStrs.CONVERT );
         } else {
              var xmp;
              if (value == "")
                   value = " ";     
              try{
                   xmp = new XMPMeta( activeDocument.activeLayer.xmpMetadata.rawData );
              } catch(e) {// no metadata so create new and add namespace
                   xmp = new XMPMeta();
                   var linkNS = new Namespace ( 'link', ns );
                   XMPMeta.registerNamespace ( linkNS, 'SOlink' );
              try{
                   xmp.setProperty(ns, property, value );
              } catch(e) {
                   alert( ErrStrs.FAILEDMETADATA + e);
              activeDocument.activeLayer.xmpMetadata.rawData = xmp.serialize();
         unloadXMPLibrary();
    If the file being linked has metadata you can use the ModifyDate in the XMP.
    function getfileDate( file ){
         var date = new String();
         try{
              loadXMPLibrary();
              var xmpf = new XMPFile( file.fsName, XMPConst.UNKNOWN,
                                       XMPConst.OPEN_FOR_READ );
              var xmp = xmpf.getXMP();
              xmpf.closeFile();
              date = new XMPDateTime( xmp.getProperty
                                  (XMPConst.NS_XMP, "ModifyDate").toString() );
         }catch(e){// fallback to OS file date
              date = new XMPDateTime ( file.created );
         date = date.toString();
         unloadXMPLibrary();
         return date;
    The hard part will be getting the layer to 'sense' when the original has been changed. If you don't want the user to trigger the test you will have to use an event like open.

  • Easy Question How to create Basic Groups and add respective Users

    Please help. I need to know how to create a basic group and later add users to the group. The group name would be callled Hardware and I will add johnsmith and janedoe to the group. Should I concern myself with the group id for whatever reason? I think the command is somthing like groupadd. Do I do somthing like:
    # groupadd Hardware
    # useradd -G Hardware johnsmith
    # useradd -G Hardware janedoe
    I'm using Solaris 10 if that helps.
    A million thanks I very New2Solaris,
    Johnny Mac

    Ok here is what I found on the net:
    change a user's group information change a user's primary group membership:
    usermod -g Hardware johnsmith
    usermod -g Hardware janedoe
    I forgot to mention that these are existing accounts (sorry)
    In order to change user's supplemental group membership:
    usermod -G Hardware johnsmith
    usermod -G Hardware janedoe
    is the supplemental group simply adding them to another group and not changing there primary group, which by default I think is staff. I would like to keep them in staff and add them to another group, in this case Hardware.
    Anyones thougths?

Maybe you are looking for

  • My iPod Shuffle is not WORKING! Advice please!

    Hello, I have iPodShuffle that stoped working this weekend. Just like that! When I say stop working, mean it doesn't appear in Finder or iTunes, but it mounted /Volumes/ without contents. (I also use my iPodShuffle as file storage for over a year now

  • My iPod Touch isn't being recognised on iTunes on my windows xp pc

    Help, I have been trying to sync my iPod touch with my iTunes for over a week now, I have read upon troubleshooting and other various problems. I have downloaded the up to date iTunes but still will not recognise it. When I plug the iPod in, in makes

  • Help for identifing top sql statements

    Hi all, We are doing load testing on oracle 9i with 500 concurent users. At some point of time the database was hang. I would like to know which query is taking more time/ which resource occuping more. Can any body help in this regard. Thanks in adva

  • What is Inside Wire Maintenanc​e and is it really necessary

    I'm getting Charged 9.99 a month for Inside Wire Maintenance.  I just want to be clear on what it really is. I've been reading that without this "insurance" Verizon would charge me a ridiculous amount of money to fix any problems if it were a problem

  • 9 Multiple artists on iPod & only 2 in iTunes

    I have 9 multiple artists on my iPod & 4 in iTunes; On iPod: The Bloodhound Gang (5 times) & Bloodhound Gang (4 times) On iTunes: The Bloodhound Gang (2 times) & Bloodhound Gang (1 time) I have attempted to delete Bloodhound Gang on iTunes, only to h