//  File: des4.C
//
//  The dangers of destructors, part 4

#include <stdio.h>
#include <stdlib.h>
#include "record.h"


Record foo(Record T) {
   Record R(2, 'r');

   printf("\nIdentify T: ") ;
   T.id() ;

   printf("\nIdentify R: ") ;
   R.id() ;

   R.field1 += T.field1 ;

   return R ;
}


main() {
   Record S(1, 's') ;
   Record P ;

   printf("Identify S: ") ;
   S.id() ;

   printf("Identify P: ") ;
   P.id() ;

   printf("\nDo Assignment\n") ;
   P = foo(S) ;
   printf("Finished Assignment\n\n") ;

   printf("Identify S: ") ;
   S.id() ;
   
   printf("Identify P: ") ;
   P.id() ;

   printf("\n\nEnd of main()\n\n") ;
}
