And now are forward here let us remove all discord and let us explore more.
Now suppose you want to print your legacy name so here I will simply define that space.
Name equal to.
Let's see Steve.
Now let us try something different.
Let's see that space.
Name on all of their dipole string.
And later on.
Use name equal to Steve.
And here it is in the name and now it is called.
So in the output we get Steve right.
Now suppose I want to print this name with the help of some With the help of some function defined inside
though my first files are guilty.
So here on the side I will simply create one would function by using the keyword of.
If you end legacy display use the Blackard open and close and defined the method Barbie.
Now inside this does use brain.
And here there is aspirin Steve.
Now my object is that I want to pass this value here.
Inside their display method so far that what they really do I would simply define a variable like say
name colon then string.
Now in Cartland in order to define any variable along with their data type the syntax is this.
First you need to define the variable name followed by a colon and then you find a date or type.
So here instead of printing this Steve directly they can simply print out name.
And now here.
Just replace this statement by display and then simply pass name variable.
So when this statement will be executed in the runtime this de-value which is present here will fall
here and henceforth it will be printed inside their display method.
Let us know what an hour called.
So here we get Steve in the output console.
Pretty simple.
Now instead of this function suppose if I wanted to create a class and build this function within that
class then how to do it.
So for that what they really do here on the side I would simply create my class class space like say
person followed by Bakker's open and close and insert this class of person.
I would simply call this method from here and pasted within this person class plus now to access this
method we have to clear the object of this class person as we all are aware of this right.
So here let us remove all discord.
So here what they will do here.
I will simply create Let's see VAD space but isn't large the object equal to person.
Now if you notice in case of Cartland we don't have any new keyword compared to Java.
There we used to use the new keyword to create an object right.
So this will simply create the new object of that type of person.
And now don't decide you can simply access this display method by using an object d'art display right
and then simply pass name as update.
And now then we will render code.
Then when the statement will be executed this function will be called as inside the class person and
hence this will be executed.
Now it will simply display Steve in the output.
So let us know what an hour code.
So here again we get Steve in the output.
Now let us genderless more.
Now suppose I've worn this name variable to be defined inside the class person.
So the syntax is very simple.
Here again let us define that space name followed by a clone of their type of string.
So we defined the name variable of the type of string right.
And now here it says the property must be initialized or be abstract.
Let us give the initial value of let's see a blank string and now add that up.
Let us remove these two lines of code and then more then we do is.
I will simply remove again this line of code and then use Berzon object dord.
Let's see Neame equal to Steve.
But I now suppose if H is this that to well then it will simply show this error here because the value
of this name cannot be changed.
If we are using the Val keyword.
Right.
So always remember this.
So let us change it back to that.
And now the name becomes Steve.
Now here.
Very rarely do we simply call their display metrics person object guard display and simply pass name
as paramita.
But here this name should be used with the help of person object dog name.
And now let us run the code so the output.
Again we get Steve here.
Right so our code is now working perfectly fine.
Now what if I tell you that instead of passing the name here to simply remove this from here and now.
Also let us remove this display method from here and now here.
Let us print this name which is actually this name present here which is actually the field variable
of the class of person right.
So let us know what an hour.
So again Steve in the output.
So everything is working perfectly fine and this video is just meant to make you more comfortable with
the Cartland language.
We will explore each and every concept in detail in our upcoming mortuis so please don't worry about
it.
If you are unable to understand some concepts right in this video.
And now let's try something different.
Let us do one thing.
Let us remove this Metford display and now they really do is suppose here.
I want to print the Steve name inserted the main method.
So for that I will simply use the print method.
And then I will simply use the name of the person is your space and then use this symbol and then simply
use it as an object.
Don't mean and then simply then the called.
So in the output we get the person the name of the person is Steve.
Right.
And now this is the usual syntax that I have followed here which is also being followed in case of Java
C programming or C++ programming.
Now in Scotland we have the concept of string in the Appalachian there what you will do.
You can simply code it from here and pasted within the double called.
And now to make the compiler understand that we have to extract the value out of this name variable.
So for that we have to simply use the curly brackets here.
And also here and then use the Dollar Sign here.
So this will simply make the compiler understand that he has to extract the value from the person object
d'art name and put it right within the codes.
So let us note in our code.
So here again Vigurs the output the name of the person is Steve.
But I suppose if I remove the curly bracket from here and also from here then the compiler will simply
understand that this string interpolation has been applied to this object not this name.
Right.
So let us know.
And the code and see the output.
So here we get something weird output person or something like that.
Daut name.
So the compiler simply understand that you have to give the value for this person object.
This is actually just basically the address of this person object.
So here make sure you always use the curly bracket open and close the end to print the value of name
in the output.
Right.