Hello and welcome to the golden programming language course in the previous session, we talked about
the declaration of this time.
And in this session, we want to talk about the other AUSTRAC's concept.
Creating instances of strike twice, we can create an instance from this, right in several different
ways.
Divide Akiva to create a striking stance, declaring and initializing a strike instance, using a strike,
literally declaring and initializing a strike instance, using named fields, declaring an initializing
airstrike instance on initialise fields are set to their corresponding zero value Astrud instantiation
using nuclear war and strike instantiation using Palminteri axis operator.
Now go to Vasco to illustrate how to create instances of strike types.
First, they divide keyboard to create a destruct instance.
First, we create this right type like address time.
I address this.
And said that feels like it's the type of it is a strange.
Cty Typekit estranged and zip code.
Too tight, is it before the quote and save the policy, we define and address this.
Now go to the main function and create instance from the address is struck first by that keyword, that
name like a name of a strong address.
First, we declare the variable of this time, and all this fields are initialized with have zero value
now displayed this struct, for example, FP a reform that they call safe deposit and execute the code
first go to the project folder.
And it's wrong that.
Is wrong
now we can see the output we create is strong and display it because we don't initialize it, doesn't
have any values.
Go to the next deep learning and initializing estranged instance using astronaut literally.
Go to the code, remove the previous cold,
for the example, create this strong variable like a form a long he equals name, office type, address
shall broadcast and initialize the value, for example, for the state city Texas and full city city
dollars value.
And for the zip code, we set one two three four five.
Go to the next line and display this one by the following code fifty.
It's this warm caller, and they want reform, they quote, save the project and execution.
They call.
Now we can see the output.
We could define and initialize its fields by using a strong laser to go to the next way, declaring
and initializing a strike instance using naming fields first clear the Lasko, for the example, create
a strong variable like a two a two crawling equals address, clearly.
Now sit name or field and assign value to it like a state like California.
And said full name city
and city value, follow the example the San Diego.
And zip code sits value six seven, eight nine zero and go to the next line and display this right by
the following pool the address to column A to reformat article, save the project and execute the program.
Now we can see the output.
We could initialize a strike instance by field name.
Go to the next we.
Declaring an initializing a striking instance on initialise views are set to their corresponding zero
value, for the example, create a striped variable like a tree and initialize its clear Lasko.
A tree calling equals Atreus and set estate and value takes us to the next line and display this drive
by this code.
AFP and address three colour and a tree before reformatted could save the project and execute the program.
Now we can see the output because we don't initialize any value for the other fields of addresses,
strong zero value assigned to then now go to the next.
That's right, instantiation using new you want an instance of estrogen can also be created with the
new keyboard.
It's been possible to assign data values to the data fields.
Using dot notation creates struct variable like A4 by new keyboard and past name of as strong as typed.
First clear the last code.
A four column equals new and set the name of a address.
Now, for assigned values to its right field, we can access to them by dot notation, first right name
of business A4 and then set dots and access to its right fields.
For example, a four dots state and then initialize the field by equals two equals.
For the example, illinois's you're
a fool.
Broad City equals Chicago.
You go to the next line.
A full zip code equals, for the example, two four, six eight and.
Go to the next line and display to create a strong variable by the following code FP address four columns
a four g format.
The Code save the project and execute the program.
Now we can see the output.
We could define this right instance by new keyboard and initialize its trunk built by dot notation.
Go to the next three struct instantiation using -- transmis operator creates an instance of airstrikes
by using a pointer answers operator is denote the by ampersand symbol first to the last call.
And create a variable like a fine that a fine equals and for some.
Name of this address now set this site filled by notation.
Go to the next line.
A five dots state equals, for the example, New York
go to the next line a five.
That city equals New York City and set the zip code.
They find that ZIP code equals one three five seven nine.
Go to the next line and display this striking instance.
Created FP Address five column.
Sit right here that a fine reformat the code, saved the project and executed the program.
We can see the output.
We could define an historic instance by using a point, an address.
Indecision.
We could create instances of this, sometimes in several ways in order not to prolong the time of decision.
We will finish it and we will continue the content in the next session.
Goodbye.