inherit: Added copying as template
This commit is contained in:
parent
bab718905d
commit
defc028857
@ -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);
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user