//  File: des7.C
//
//  The dangers of destructors, part 7

#include <stdio.h>
#include <stdlib.h>
#include "string.h"
#include "record2.h"


Record foo(Record T) {
   Record R("R");

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

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

   return R ;
}


main() {
   Record S("S") ;
   Record P ;
   char *str1, *str2 ;

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

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

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

   str1 = strdup("Hello") ;
   printf ("str1=(%p,\"%s\")\n", str1, str1) ;

   str2 = strdup("World") ;
   printf ("str2=(%p,\"%s\")\n", str2, str2) ;
   
   printf("Identify S: ") ;
   S.id() ;

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

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