@interface Aodi : Car
- (void)carBeep;
@end
@implementation Aodi
- (void)carBeep
{
NSLog(@"aodi 响了");
}
@end
@interface Baoma : Car
- (void)carBeep;
@end
@implementation Baoma
- (void)carBeep
{
NSLog(@"baoma 响了");
}
@end
void leep(Car *c)
{
[c carBeep];
}
int main()
{
@autoreleasepool
{
Baoma *baoma = [Baoma new];
leep(baoma);
Aodi *aodi = [Aodi new];
leep(aodi);
//NSLog(@"%d个轮子的车子的速度是%d",car1->wheels,car1->speed);
}
return 0;
}