From defc0288574cd7394e29e346d3fcd255ae592f6a Mon Sep 17 00:00:00 2001 From: Logen Kain Date: Wed, 25 Jan 2017 20:38:42 -0700 Subject: [PATCH] inherit: Added copying as template --- inherit/main.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/inherit/main.c b/inherit/main.c index 2b3fd13..b794429 100644 --- a/inherit/main.c +++ b/inherit/main.c @@ -4,6 +4,7 @@ int main () + { typedef struct { @@ -31,9 +32,15 @@ int main () strcpy(herCar.brand, "Saturn"); printf("Her car's life is: %d\n" "Her car's magic is: %d\n" - "Her car's brand is: %s\n", herCar.vehicle.life, herCar.vehicle.magic, + "Her car's brand is: %s\n\n", herCar.vehicle.life, herCar.vehicle.magic, herCar.brand); + Car herCar2 = herCar; + + printf("Copy of HerCar\n" "Her car's life is: %d\n" "Her car's magic is: %d\n" + "Her car's brand is: %s\n", herCar2.vehicle.life, herCar2.vehicle.magic, + herCar2.brand); + }