i have defined a new class called StockHolding that has all the methods and instance variables of the class NSObject. And added 3 instance variables:
@interface StockHolding : NSObject
{
float purchaseSharePrice;
float currentSharePrice;
int numberOfShares;
}
Also, i've added instance methods
- (void)setPurchaseSharePrice:(float)p;
- (void)setCurrentSharePrice:(float)c;
- (void)setNumberOfShares:(int)n;
At main.m file i created an instance of class
StockHolding *stock = [[StockHolding alloc] init];
and want to create and object with variables
StockHolding *a = [stock setPurchaseSharePrice:2.30 setCurrentSharePrice:4.50 setNumberOfShares:40];
but receiving error
No visible @interface for 'StockHolding' declares the selector 'setPurchaseSharePrice:setCurrentSharePrice:setNumberOfShares:'
What i'm doing wrong? Or its just not proper use of inherited instance.
I saw example:
NSCalendar *cal = [NSCalendar currentCalendar];
NSUInteger day = [cal ordinalityOfUnit:NSDayCalendarUnit
inUnit:NSMonthCalendarUnit
forDate:now];
or this won't work?