🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.objective-c
Article #199

method inheritance in NeXT ObjC classes

#199
From: W Jamison
Date: Sun, 11 Oct 1992 17:02
90 lines
1952 bytes
I have been trying to define a class called Stack that is a subclass 
of the NeXT Common Class List.  When I compile and run the program,
I receive the following error message:

	error: Stack does not recognize selector +addObject: IOT trap

Am I wrong in thinking that Stack should recognize the methods
for its superclass List?

I have included the @interface and @implementation files for the
subclass Stack I have written below.  Can anyone tell me what I
have overlooked?  

					Wes Jamison
					University of Pittsburgh
						at Greensburg
// file Stack.h
/* Interface File */

#import <objc/List.h>
#import "Integer.h"

@interface  Stack: List
{
	/* no new instance variables for subclass */
}

/* factory methods for class */

+new;

/* instance methods for class */

-push: (int)input;
-(int) pop;
-display;

@end

/* Implementation File */

#import <stdio.h>

@implementation  Stack:List

/* Details of factory methods  */

+new
{
	self = [super new];
	return self;
}
	
/* Details of instance methods */

-push: (int)input
{
	id myStack;

	[myStack addObject:[[Integer new] set: input]];
	return self;
}

-(int)pop
{
	int output;
	id myStack, myInteger;
	
	myInteger = [myStack removeLastObject];	
	output = [myInteger show];
	[myInteger free];	            
        return output;
}

-display
{
	id myInteger, myStack;
	int i;
	
	
	for (i = 0; i <= [myStack count]; i++)
		{
		myInteger = [myStack objectAt: i];
		printf("%d\n",[myInteger show]);
		}
		printf("\n");	
}	
@end

	
Technical Details
Message-ID: <7493@blue.cis.pitt.edu.UUCP>
Path: arc1-ca.pugleaf.net!sparky!uunet!gumby!destroyer!gatech!pitt.edu!jwj

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!gumby!destroyer!gatech!pitt.edu!jwj
From: jamison@vms.cis.pitt.edu (W Jamison)
Newsgroups: comp.lang.objective-c
Subject: method inheritance in NeXT ObjC classes
Message-ID: <7493@blue.cis.pitt.edu.UUCP>
Date: 11 Oct 92 17:02:40 GMT
Sender: news+@pitt.edu
Organization: University of Pittsburgh
Lines: 90
Originator: jwj@unixd1.cis.pitt.edu