My Blog List

Tuesday, November 2, 2010

Demonstrating Polymorphism OR TRAPPED IN TIME?

Version:1.0 StartHTML:0000000201 EndHTML:0000074336 StartFragment:0000002867 EndFragment:0000074300 SourceURL:file://localhost/Users/Laurel/Apps%20Learning/Journal%20TrappedInPolymorphicTime.doc
// TrappedInTime

Loading program into debugger…
Program loaded.
run
[Switching to process 7629]
Running…
    PERIOD PILOTS Staff Members are currently performing maintenance on this portal
Your trip is being routed to another time portal.
 Thank you for your patience
 ....    PERIOD PILOTS Maintenance Log for Tuesday, November 2, 2010

 Performing Maintenance on Time Portal of type: Bridge

Performing Maintenance on Time Portal of type:  Canyon
Performing Maintenance on Time Portal of type:  Canyon
Performing Maintenance on Time Portal of type:  Canyon
Performing Maintenance on Time Portal of type:  Canyon
Performing Maintenance on Time Portal of type:  Canyon
Performing Maintenance on Time Portal of type:  Canyon
Performing Maintenance on Time Portal of type:  Canyon
Performing Maintenance on Time Portal of type:  Canyon
Performing Maintenance on Time Portal of type:  Canyon
Performing Maintenance on Time Portal of type:  Canyon
Performing Maintenance on Time Portal of type:  Canyon
Performing Maintenance on Time Portal of type:  Canyon
Performing Maintenance on Time Port

* * * TASK CANCELLED BY PORTAL PILOT SUPERVISOR * * *



//  Or why Time Portal Constructors need to wear the right GLASSES  @ the computer
// I was so enchanted with the bug I created using an = instead of a < to control my loop, that I was determined to return
//       AFTER ALL
//  As we learn from reading history, great scientific discoveries are often made by mistake
//         OR
//  It's a feature not a bug

for(loopIndex =0; loopIndex < 2; loopIndex++)
  // for(loopIndex =0; loopIndex = 2; loopIndex++)



WHAT WE EXPECTED

This GDB was configured as "x86_64-apple-darwin".tty /dev/ttys000
Loading program into debugger…
Program loaded.
run
[Switching to process 7588]
Running…
    PERIOD PILOTS Staff Members are currently performing maintenance on this portal
Your trip is being routed to another time portal.
 Thank you for your patience
 .... 
  PERIOD PILOTS Maintenance Log for Tuesday, November 2, 2010

 Performing Maintenance on Time Portal of type: Bridge

Performing Maintenance on Time Portal of type:  Canyon

....
  Maintenance Cycle of all Time Portals in this zone,
  completed properly on Tuesday, November 2, 2010

Debugger stopped.
Program exited with status value:0.



//  GettingWorkDoneInATimelyManner

//  Demonstrating polymorphism: Using the same code with different objects
//      the object that is used is determined at runtime when I pass a message

//based on example in Quick Start Objective C , Holzner, page 139
//

#include <stdio.h>

#include <Foundation/Foundation.h>

@interface Bridge : NSObject
-(void)  print;
@end

@implementation Bridge

-(void) print
{
    printf("Performing Maintenance on Time Portal of type: Bridge\n");
}

@end
//
@interface Canyon : NSObject
-(void)  print;
@end

@implementation Canyon

-(void) print
{
    printf("Performing Maintenance on Time Portal of type:  Canyon\n");
}

@end

int main (void) {
    printf ("\t PERIOD PILOTS Staff Members are currently performing maintenance on this portal\n");
    printf("Your trip is being routed to another time portal.\n Thank you for your patience\n");

    printf("\f.... \f  PERIOD PILOTS Maintenance Log for Tuesday, November 2, 2010\n ");
   
    Bridge *c1 =  [Bridge new]  ;
    Canyon *c2 =  [Canyon new]  ;
    id pointerToObject;
    int loopIndex;
   
    pointerToObject = c1;
   
 for(loopIndex =0; loopIndex < 2; loopIndex++)
    //  for(loopIndex =0; loopIndex = 2; loopIndex++)
    {
        [pointerToObject print];
        pointerToObject = c2;
       
    }
   
   
    printf("\f.... \f  Maintenance Cycle of all Time Portals in this zone, \f  completed properly on Tuesday, November 2, 2010\n ");

    return 0;
}



2 comments:

  1. HOLY MOLEY!! That's some faaaaaarrrrrrrrrr out thinking!! I'm stuck in 1916, and I hardly speak the language...

    ReplyDelete
  2. So sorry you seemed to have slipped through a time cracks.We'll get our engineers on it right away, Madam.

    ReplyDelete