To what class does this method belong?

If one sees in the documentation something like
- (retType *) text1:(Type1 *)aType1 text2:(Type2 *)aType2;
then to what class does this method belong? I do not see in the Objective-C documentation any way that one can tell without the 'context' in which the method is declared or defined. This makes reading the documentation very difficult (for me). What you see is not what you get. There is stuff missing.
In my world there is no difficulty in determining the class to which a method belongs. It is stated explicitly in the method name. For example:
PROCEDURE (self: MyClass) methodName (arg1: Type1; arg2: Type2);
and one sees that 'methodName' belongs to 'MyClass'.
In Objective-C how does one know the class to which a method belongs? Is it only determined by context, that is, by the fact that it is within the @implementation section or that it is within the @interface section? If that is the case then I would think that in documentation one should always be required to assert something like:
<<MyClass>> -(retType *) text1:(Type1 *)aType1 ...
-Doug Danforth

PeeJay2,
I think I now have the distinctions needed but still have a question about what you said. But first here is my current understanding. A "method" is by definition bound to *at least* one class whereas a "message" need not be bound to any class. Hence one can send any message to any class and it will either be handled or ignored. A message looks like a method signature (and maybe one but is not constrained to be one).
The difference between C++ and Objective-C is that in C++ method calls are not messages sent to a receiver. They are just calls of the method for the dynamically bound object. That method must be syntactically correct at compile time whereas messages need not be syntactically correct for any receiver. At least that is my current understanding.
Now my question. You state that "casting the receiver of a message will in no way alter the flow of the code". I attempted to test this with a simple program but ran into a problem (see my new posting "Multiple classes in one file?").
Assume the following
@class Child : Parent
Child *child = [[Child alloc] init];
Parent *parent = [[Parent alloc] init];
Parent *bar;
bar = child;
[bar doSomething]; // (C) call to child's doSomething method?
[(Parent *)bar doSomething]; // (P) call to parent's doSomething method?
You comment seems to say that both case (C) and (P) give the same result. If they do then which result is it the parent's or the child's method (assuming that the child has indeed reimplemented the parent's method)? Have I understood you correctly?
-Doug Danforth

Similar Messages

  • What class does setVisible() come from?

    What class does the setVisible() come from?
    and
    Where do find the method to disable the ability to resize a window?
    Thanks

    These answers and more from you friendly local API...
    http://java.sun.com/j2se/1.4.1/docs/api/

  • I'm trying to sync/back-up apps on my iPhone 3G and iTunes keeps telling me it can't complete the operation because "the apps on my iPhone cannot be determined." What the **** does this mean?!

    I'm trying to sync/back-up apps on my iPhone 3G and iTunes keeps telling me it can't complete the operation because "the apps on my iPhone cannot be determined." What the **** does this mean?!

    Same problem. Wish I knew.
    When I tried to Restore, I got an Error 13xx and it won't even do that.
    not a happy camper if a phone this expensive stops working in 2 years.

  • Consolidate Masters - what exactly does this do?

    Hi all
    I am a relativity new aperture user. every time i import images from my camera, they have the little arrow in the bottom corner to show they are referenced files.
    I can fix this by clicking file>consolidate masters and choose to move or copy them.
    Forgive the basic-ness of this question, but what exactly does this do? And why can't i import them so they are not referenced files?
    thanks again for your help

    I suggest you read the manual for this sort of questions, but anyway, here's a quick answer:
    -consolidate masters moves or copies your images to somewhere withing your library, making them managed instead of referenced.
    -the import dialog, when you connect a card has the option to copy the files to anywhere on your disk, to pictures or to the library (making them managed, and thus not showing the little arrow).
    For the advantages and disadvantages of either, check this forum or again, the manual.
    j

  • HT201210 My iPhone became wet at the beach.  I put it in rice for 4 days.  When I connect to itunes, it says the phone must be restored.  It starts and then gives either the error 2001, or 2006.  What exactly does this mean, and is it worth getting repair

    My iPhone became wet at the beach.  I put it in rice for 4 days.  When I connect to itunes, it says the phone must be restored.  It starts and then gives either the error 2001, or 2006.  What exactly does this mean, and is it worth getting repaired?
    Thank you...

    http://support.apple.com/kb/TS1275
    Water damage isn't covered by warranty, but you could always purchase a refurbished device from Apple. 

  • HT2534 what country does this work for? no such caption as none on the paying option

    what country does this work for? no such caption as none on the paying option

    As far as I am aware it works for all countries. You are following the instructions on that page exactly e.g. it's a new account that you are trying to create and you are selecting a free app in the store and clicking on 'create Apple id' when 'buying' it ?

  • Audigy SE Varpack - $25 US - What chip does this u

    Hi,
    A new cheapo audigy card has been appearing at stores lately called the Audigy SE or Audigy SE VarPack for $25 US.
    Does anyone have any experience with this card?
    I'm most interested in the chip used as I had a bad experience with an Audigy LS. The audigy LS does not use an emu0K chip, which means it's a piece of poop. (On the good side, I got it for $0.00). From one of the beta drivers that was released sept 09, it said the audigy ls/audigy se was not supported. Does this mean it's using the same chip?
    I'd appreciate any feedback ) chip 2) rightmark test.
    It's crucial to me that I get a card with an EMU0K chip.
    thx.
    BTW: calling the LS soundcard an audigy LS was false advertising. We expected the board to use the EMU0K chip and it didn't. What you'll get is 0% CPU usage instead of sub 5%. The LS was no better than motherboard audio solutions.

    From other boards, I think it's best to assume the Audigy SE does not use an Audigy Chip.

  • What class calls the method?

    If there is a method in a class that could be called by any one of, lets say, one hundred other classes, in that method is there a way of printing out the name of the class that called it ?
    So if class Xyz calls the method I would like to just do a println in the method saying that class Xyz called it ?

    Yup... Thread.currentThread().getStackTrace();
    package krc.utilz;
    import java.io.PrintStream;
    public class Tracer
      public static PrintStream out = null;
      public boolean enabled = true;
      public enum Format { LONG, SHORT }
      public Format format;
      public Tracer() {
        this(System.err, Tracer.Format.LONG);
      public Tracer(PrintStream out) {
        this(out, Tracer.Format.LONG);
      public Tracer(Format format) {
        this(System.err, format);
      public Tracer(PrintStream out, Format format) {
        this.out = out;
        this.format = format;
      public String toString() {
        return get(5);
      public String get() {
        return get(2);
      public String get(int i) {
        StackTraceElement[] st = Thread.currentThread().getStackTrace();
        if (i>=st.length) i = st.length-1; //don't go past top of stack
        StackTraceElement t = st;
    String s = t.getFileName()+":"+t.getLineNumber()+":";
    if (this.format == Format.LONG) {
    s += t.getClassName()+"."+t.getMethodName();
    return(s);
    public void debug(String msg) {
    if(!enabled)return;
    out.println("DEBUG: "+msg);
    public void print(String msg) {
    if(!enabled)return;
    if (out==null) return;
    out.println(get(3)+" : "+msg);
    public void print() {
    if(!enabled)return;
    if (out==null) return;
    out.println(get(3));
    public void print(int i) {
    if(!enabled)return;
    if (out==null) return;
    out.println(get(i));
    public static String getCurrentMethodName() {
    StackTraceElement[] st = Thread.currentThread().getStackTrace();
    return(st[2].getMethodName());

  • Strange shape shifting, and I don't know what is doing this?

    Ok, as an experienced illustrator user I have to admit that I am stumped on this. I have been using CS5 for 3 months now (upgraded from CS3) and I notice many new features. But, as I was doing a basic drawing for an icon I noticed that my image was getting distorted when I moved it around the screen after scaling the object. This is what I am doing, (1) used the pen tool to draw icon, (2) converted the image to outlines, (3) used pathfinder to merge all shapes, (4) deleted unwanted shapes, (5) moved drawing to different position on art board, and noticed first few vector points moved, (6) scaled the object and moved it to another position on the art board and it really started to distort image.
    (Note that I am moving the object using the solid arrow tool and I am not clicking on individual points when I move the image. I also cut and paste this image into a new document and it did it again. That is why I don't think it is a corrupt doc but a setting issue.)
    I included some screen images of what I described happening with the image shifting its shape. I thought a setting was causing a problem, like snap to "pixel grid" or some other new feature that I am not aware of coming from CS3.
    I hope I am giving enough info to help solve this issue for me. Thanks

    Thanks for the fast reply. I found the "Align New Objects to Pixel Grid" was selected in the Transform Panel. I unchecked this and it looks like the solution. I checked the Illustrator Prefs, under Guides & Grid and didn't find a similar box. I only found show grids and color choices for a grid. But, I think the transform panel is what I needed.
    Out of curiosity, I went to look at the "New Document" settings and found the check box under the advanced panel. I don't know how that was turned on, but that must have been the default for all of my current new documents. This preference doesn't just activate depending on the "New Document Profile" selection does it? Let's say if I chose "Web" as the profile, does this automatically select?
    Thanks for your help, very much appreciated.

  • Getting stuff of my ipod onto my Windows computer, what app does this?

    Hello,
    So I have a Mac at home and a Windows at work. I had my ipod synced to my Mac at home and it now has all the TV shows, music etc. on it. Then I switched it to sync manually thinking it would then work at work. Well I have XPlay which allows me to plug it in at work on my Windows but then when I plug it in at work it says do you want to sync with this computer and I don't since I have nothing on my itunes at work yet.
    So is there an app for PC that allows you to get stuff off your ipod onto your computer so then I can put all that stuff on my Windows itunes at work? I know there is a Mac app that does this called ipod viewer and it's freeware or ipod access which isn't freeware.
    Anything like this for Windows?

    deggie,
    Thanks, I've heard of that one for Mac as well. I'll give it a try tomorrow at work and see if it works for me.

  • HT2534 Does this method still work for creating Apple ID without CC?

    An instructor of mine just tried this method and said it no longer works. Has anyone else had trouble with this process?

    It is still valid. Note that you have to be creating a new Apple ID. You can't use an existing one.
    Regards.

  • What version does this refer

    When you go into recovery mode, the first line says:
    Creative Zen Micro v0.0.58.
    What version is this referring to It can't be the firmware, since my firmware comes up as .02.05.
    Thanks,
    CityRoamer

    du musst versuchen die firmware von einem anderen pc aus zu installieren. ich hatte heute genau das gleiche problem. der player hat sich beim upgraden aufgeh?ngt und dann war nur die halbe firmware drauf. du musst die firmware l?schen bevor du die neue von einem anderen pc l?dst. das doofe ist nur, dass der player an meinem pc nicht richtig erkannt wird, im ger?tmanager von win xp steht zwar der player drin, aber ich kann weder ?ber den windows explorer, media player 0 oder eben media source organizer auf den player zugreifen. schlie?e ich den player nun an dem anderen pc an, wird der creative sofort erkannt. windows media player 0 will ihn sofort mit musik f?ttern und auch ?ber den windows explorer ist er nun per drag&drop bef?llbar. ich habe mittlerweile schon mein komplettes system neuinstalliert, aber auch das hat nichts gebracht. ich wei? nicht mehr was ich machen soll und warum der player nur an meinem pc nicht mehr funktionieren will. wenn er kaputt w?re oder so, dann w?rde er ja auch nicht an dem anderen pc funktionieren.

  • What class called my method?

    I have tried using the StringWriter and the printStackTrace() methodology for finding out the name of the method that actually called my class and it works fine. But the problem is that the execution time is too high (abt 70msec). I need a better and more efficient way of finding this out.
    Does someone have an idea of how to do this?
    Regards,
    Manoj Rathod.

    Ok, this was my test code:
        public class MethodTrace {
            public static void main (String[] args) {
                method3(false);
            public static void method1 (boolean stop) {
                StackTraceElement e[] = (new Throwable()).getStackTrace();
                System.out.println("method1: called by " + e[1].getMethodName());
                if (!stop) method3(false);
            public static void method2 (boolean stop) {
                StackTraceElement e[] = (new Throwable()).getStackTrace();
                System.out.println("method2: called by " + e[1].getMethodName());
                if (!stop) method1(true);
            public static void method3 (boolean stop) {
                StackTraceElement e[] = (new Throwable()).getStackTrace();
                System.out.println("method3: called by " + e[1].getMethodName());
                if (!stop) method2(false);
        };And this was the output:
        method3: called by main
        method2: called by method3
        method1: called by method2As for the speed, I don't know. It's cleaner than using printStackTrace(), and I would think it would be faster. But I'm not sure.
    Why do you need to know the calling method, though? Perhaps there is some other, faster way to do what you want to do that doesn't have to use any stack tracing stuff at all.
    Or maybe you could just call the method, passing the name of the calling method as a String parameter:
        public void excellent (String caller) {
            System.out.println("Called by " + caller);
        public void superb () {
            excellent("superb");
        public void hard () {
            excellent("hard");
        };Lemme know if you find out anything interesting.
    Jason Cipriani
    [email protected]
    [email protected]

  • "Prefer Adobe Camera Raw" - What exactly does this do?

    What is the significance of the "Prefer Adobe Camera Raw for JPEG and TIFF"?
    I ran into the following issue:
    I update some of the fields in the IPTC metadata. In particular the title and keywords. I'm running Vista 64, and both changes faithfully appear when I view the file with Vista's picture browser or even in Windows Explorer. So far so good.
    I'm then also uploading the pictures to a Menalto Gallery website. Here is when I run into trouble.
    - If I have Prefer ACR checked of when I update the IPTC then the gallery website does not pick up on the metadata.
    - If I have Prefer ACR checked off when I update the IPTC then the gallery website is able to pick up on the metadata and assign captions on the website accordingly.
    So I'm trying to figure out what the difference between prefer ACR on and off is, and why this would affect reading of the metadata by a third party application.
    Thanks!
    Carlos

    After much digging, I've been able to come up with a rough answer to my own question.
    It appears that when the "prefer ACR" setting is on, Bridge saves older versions of the Metadata (in the XMP IDF, I believe). When displaying a file's metadata, Bridge knows to only display the latest version.
    It would appear that Windows Vista's built-in photo tools are also smart enough to only display the latest version of the metadata. Other tools (such as the Gallery software), however, appear to get confuse and display an older version of the metadata.
    In short, the conclusion I've arrived at is: If you want higher compatibility across applications, turn OFF "prefer ACR". If you value versioning information then keep ON "prefer ACR".

  • Screen shows aflashing question mark on a black folder and alternates with a small globe illustration?  What's does this mean?

    MY screen shows a flashing question mark on a dark folder and alternates with a small globe symbol  ---does anyone know what this means?

    How many accounts do you have?
    Regardless,  https://discussions.apple.com/message/25709811#25709811

Maybe you are looking for