title: NSCopying & Inheritance
body: <p>Please have a look on following code :------- .h</p>
  
  <pre><code>@interface BankAccount : NSObject&lt;NSCopying&gt;
  {
      double accountBalance;
      long accountNumber;
      NSString *CustomerName;
      NSString *AccountType;
  }
  
  -(void) setAccount: (long) y andBalance: (double) x;
  -(void) setCustomerName: (NSString*) name andAccountType: (NSString*) type;
  -(id)copyWithZone:(NSZone *)zone;
  
  @end
  
  @interface Savings : BankAccount
  {
      int number;
      NSString *Offer;
  }
  -(void) setSavingNumber: (uint8_t) num andOffer: (NSString*) offer;
  -(id)copyWithZone:(NSZone *)zone;
  @end
  </code></pre>
  
  <p>---------- .m</p>
  
  <pre><code>@implementation BankAccount
  
  -(void) setAccount: (long) y andBalance: (double) x
  {
      accountNumber = y;
      accountBalance = x;
  }
  -(void) setCustomerName: (NSString*) name andAccountType: (NSString*) type
  {
      CustomerName = name;
      AccountType = type;
  }
  
  -(id)copyWithZone:(NSZone *)zone
  {
      BankAccount *accountCopy = [[BankAccount allocWithZone: zone] init];
      [accountCopy setAccount: accountNumber andBalance: accountBalance];
      [accountCopy setCustomerName:CustomerName andAccountType:AccountType];
      return accountCopy;
  }
  
  @end
  
  @implementation Savings
  -(void) setSavingNumber: (uint8_t) num andOffer: (NSString*) offer
  {
      number = num;
      Offer = offer;
  }
  
  -(id)copyWithZone:(NSZone *)zone
  {
      Savings * clone = [super copyWithZone:zone];
      [clone setSavingNumber:number andOffer:Offer];************** error *********
      return clone;
  }
  
  @end
  </code></pre>
  
  <p>When run this code::::::</p>
  
  <pre><code>Savings* account1;
  Savings* account2;
  
  account1 = [[Savings alloc] init];
  [account1 setAccount:10 andBalance:1000.10];
  [account1 setCustomerName:[NSString stringWithFormat:@"%@",@"Deepak"] andAccountType:[NSString stringWithFormat:@"%@",@"Savings"]];
  [account1 setSavingNumber:2001 andOffer:@"Bad"];    
  account2 = [account1 copy];
  </code></pre>
  
  #
  
  <p>i dont know what is wrong with the code please help me. thanks in advance.</p>
  
  <p>Thanks 
  Deepak</p>