Learn How To Develop Programming Skills - OOP Classes & Objects | Sandeep Thakur | Skillshare

Learn How To Develop Programming Skills - OOP Classes & Objects

Sandeep Thakur

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
20 Lessons (1h 37m)
    • 1. Introduction

      1:22
    • 2. Classes & Objects - Real World Examples

      8:41
    • 3. Classes and Objects - Realistic Approach

      4:01
    • 4. Abstraction

      0:48
    • 5. Abstraction - Real World Example - I

      7:31
    • 6. Abstraction - Real World Example - II

      3:52
    • 7. Abstraction - Realistic Approach

      3:24
    • 8. Explanation of Abstraction with Example

      1:44
    • 9. Encapsulation

      5:42
    • 10. Encapsulation - Realistic Approach

      3:07
    • 11. Inheritance

      5:53
    • 12. Polymorphism

      4:05
    • 13. Function

      8:33
    • 14. Program on Function - I

      3:14
    • 15. Program on Function - II

      5:30
    • 16. Classes & Objects

      10:00
    • 17. Program on Classes & Objects - I

      7:41
    • 18. Program on Classes & Objects - II

      4:01
    • 19. Program on Classes & Objects - III

      7:45
    • 20. Thank You !

      0:16

About This Class

3f2c172a

Explanation of Concepts of OOP with Realistic Approach Examples

This course is design for those who want to clear concepts of OOP. 

Characteristics of OOP are explained with easy real world examples.

Easy Approach to Understand -

What are Classes & Objects ?

What is Data Abstraction ?

What is Encapsulation ?

What is Inheritance ?

What is Polymorphism ?

Realistic Approach examples helps to understand OOP step by step .

Implementation of OOP in Programs

Implementation of characteristics of OOP in programming.

Transcripts

1. Introduction : Hi there. This is something pack of will come through this course I'm going to with instructor of this course. I'm teaching programming in India and in different countries off you. I'm taking programming from last 15 years. My speculation is in C C plus plus Java that was our and in selenium going up this course is to love the concepts off food with realistic approach examples so that one gun easily make programs off a glass of objects. Course it starts with the characteristics off. What it obstruction. What is encapsulation? What is inheritance? What is polymorphism? All these things are explained by giving realistic approach examples. And once the concepts gets clear, then it is implemented in C plus plus Grammy. 2. Classes & Objects - Real World Examples: Hello, everyone create. I'm going to start to explain characteristics off who First of all, I'm going coo explainable object and I'm explained each one of the characteristics in a real world. So when I talk about object, anything which exist in real world living thing unknown living thing that is known as object anything which you can touch and feel that is known as object. So it is very easy to understand what object is at three routes and the actions, or we can see properties and behavior on the basis off Fitch Objects performed the task that is encapsulated or you can say bind up within the object on which the objects at upon and performed the dust to get the deserts. Each one of the instance have some common attributes and actions, some common properties and behavior on the basis on which it performed the task, and we get the results. So objects or objects are you when, uh, data on which it performed at dusk? Those are abstract. So those datas what you consider information, which is encapsulated having common attributes and accents that is known as class so you can call class as a blueprint design blonde template by any name, which is a quiet for an instance, or for an object to perform the task. Let me explain between another example. So I suppose I'm having a pen. So a man is object. And if I have to tell the atom Bruce and action off this object so I can see that the ink which is there inside the pen is a blue color, the body color off the pen is white. And if I have to talk about the action, I can see when the plan will make impact on the piece of paper that an ink will flow and I will be able to write on the piece of paper. So that is action. So bind up or wrap up off at the roots and Exxon often object. That is no less class. Let me explain in another way. So the things will be more clear to all of you. Suppose I want to construct ah house my house Israel. You can touch and feel so obviously house would be called object. So as I have to construct this house So what will be required to construct the house? I'm not talking about the physical things. I'm having all that. I'm having a land. I'm having the money to purchase the materials to construct the house beside this. What I required to construct the house because took this object beside the physical things . To construct this object. This house I required a blueprint, a template, a plan. You can give any name. Good. So for that I will a point are detect engineer Who is going to provide me the blueprint? A plan are designed Once I will get the design, I will be able to construct the house. So class is abstract. It's not really when the object is 1,000,000,000. So blueprint is required to construct house which we can gold class, which is a glass. If you talk and computer time large, it will be called what class? So there are a number of examples with the help of which we can understand and realistic approach. What is the meaning off object and what is the meaning? Off class? Once we will understand about class an object. And when you start making the program by using this approach, they will not be any confusion. So what is the object? Any real world entity, which can have some characteristics or which can perform some work that is called object. An object is instance off class. What is Class A Class is plan with describes the object we call it as a blueprint or template off how the object should be represented. Mainly, a class would consist off name, attributes and operations. So the common attributes and actions often in two D grouped together forms Logical unit that is no less class. So in the next video, that's some more examples. I will try to explain Class an object, Thank you. 3. Classes and Objects - Realistic Approach: God is object. And suppose if I have to draw a picture, of course. So I required information to let you do it for that vehicle is the class so God is real. While the information which is quite good, draw the picture for car. That is the abstract data which will be required for me toe throw the picture for car in the same way Apple is object and, uh, the date of which will be required to draw the picture of apple that is within the class, which is a wrap up. Or you can say bind up within the class food Tom is object and then they let it get out. Tone is inside the class customer, which isn't that data is encapsulated within the class customer. Get as object on the class off it is animal on a domestic. One more example. To understand the things. Here's one of the person and he's going to matches God from the subtle and the person name is Tom, so don't is object. Before purchasing the car hit acquires the blueprint. So once he will get the pro print, then only he will be going toe. But is the God. So what are the common attributes and the accents? Or you consider common properties and behavior that he will be quite or he's going toe perform inside the shooter. Those are name and this and the name off the guard that he's going to purchase. The actions which is going to perform is to fill up the form. Maybe he will take a test drive, made the payment. These are the actions which he has to perform to put it in the car. So Tom is object and the blueprint which is acquired, that is, plus no. If the same person this tome goes in any institute and he wanted to take admission is in that institute, then the same person will be object. But he will be the object off class student as he's going to follow the actor who's and ex insulated toe class student. And if the same person levers in any bus or train, then he's going to follow the attributes and actions off class passenger so the instances seem. But once he followed the attributes and actions off a part of Black plus, then it becomes things. Instance off the particular class at the same person Tome goes in a playground and he is He's going to follow the attributes and actions off class player. So in the real world that things are like this. I hope you understand about class and object in the next video. I want to explain something else. Thank you. 4. Abstraction: what is obstruction and formation. Hiding abstraction means at 11. Detail and dressed are hidden, as I have given example, dialing a number called Some Mattered Internally, which going to get the need, the numbers and displayed on the screen. But what it is doing internally, we don't know it is hidden. So the process off identifying necessary in formation about a component is it for dough as data abstraction? 5. Abstraction - Real World Example - I: Hello, everyone. In my last video, I have explained about object. I have explainable class. Okay, I'm going toe cover Another important topic. And that is abstraction. What is abstraction and how it issues in Peru? Me that I'm going to explain and to explain abstraction. I give a very simple example. And with the example it will be clear. A boat obstruction to explain it. I will give an example and example is that I suppose I have two constructor house and to construct ah house I required and for mission I'm going to collect information and before collecting the information, I need a blueprint. So when I am having the blueprint on the basis of the blueprint, I will collect information. And then I am going to construct the house once I will start constructing the house. And when the time came to construct the flu So what I will do? I will appoint our floor men who is going toe construct the floor off the house. So what the floor man will do? Is he going toe talk about eating everything off house? Is he going to talk about when those is he going to talk about the does is his. Is he going to talk about the walls off the house? No. Is not going to talk about each under the thing which is constructed or going to construct in the house. He will only and only talk about the floor, which he has to construct. So he's going to collect. Those in formation is going to collect those 11 in formation, which is required to construct the floor. Now the information Suppose here, um, taking L for the land B for bread and edge for the height. So he's going to act upon the information and he required floor area to calculate before starting the work. So this is example, which is Morial too more near to programming Also. So first thing, the floor man, which is required to calculate off road area. Then only he is going toe construct a full. So he's going to act upon to Dido that is Lent and Bert that is required for to calculate the floor area. So is going to act upon these two information that is the land and the bread off the food. Once he will can play the floor area will start constructing the floor. So what the foreman did He only collected 11 data which is required for the construction off the food. There were other information also related to door windows waas, but that is not required. So he ignored the rest and, uh, collect that. I live in data which is required to construct the food, and that is known as abstraction to collect the necessary information and ignored. The rest is known as obstruction. A one star house construction completed. No, a required a painter toe paint the house once I appoint a painter. So what he is going to do? Is he going to talk about windows and doors off my house? Is he going to talk about the floor off the host? No. He required that 11 data off walls because he is going toe paint the walls. He only had only talk about the walls and that 11 data, which is quite, can clear, tough for rural area. So to calculate the floor one area he will be required. The painter will be quite land breadth and height, and once he get this relevant data, he will calculate the four rural area and start painting the house I hope you understand that what I'm trying to explain and the thing is that there are informations related to house. But the floor man and, uh, painter only corrected. Does informations or Onley gift importance or emphasized toe does in for mission which are necessary for them, and they work upon them and get desserts. So to collect, necessary for mission or 11 data and in northern ist that is known as abstraction. So almost the same thing is going to implement in programming. Also once will start making the program, we're going to take instance variables inside the glass. So some of the functions may take all the instances. Instance variables to perform the dusk on. Maybe it's possible that some of the some of the functions will take on Lee few instance variables to perform the task as we have, as we have seen the example of floor to calculate the floor area and for one area. Ah, Florman and awful Pinter. So I hope for this example about that obstruction. The things will be clear. Thank you. 6. Abstraction - Real World Example - II: I have given example that this person dome this object is going toe put cheese a car from a shooting. So obviously is going to collect those information which will be required. How much is the car required? The blueprint or you consider class off it. 11 data which will be required to. But it is the car what will be the top most information, which the tone will be required to produce. The car that villa, the name that just the car he's going toe purchase the model of car he's going to purchase and what action he is going to do. Once he will enter the showroom, it will fill. The form is going to fill the name that dress, the name of the car which is going to purchase and some more former days. So these are the 11 data which is required for the tome or the former days to fulfill and to put you the car. No, if suppose Tom started talking or started gathering some more information which are not relevant, And, uh, but chasing off the car, it was, uh, he started talking about the number of employees in the showroom is taught Hey, start talking or start gathering the information related to the salary of the employees. So those informations are there. But those informations are not relevant. Are required unnecessary toe but to the cut. So no one is going to share those information. Those information are there. Does information not hidden but it is not required for the tome toe. Get on new the salary of them price are how many cars sold today, or harmony chords a car sold yesterday Onley. He's going to correct the relevant data. So what I'm trying to explain is abstraction. The many off that section is to collect the top most information order 11 data, which is required to perform a task and ignored the rest. So Tom also has to ignore the other informations which are there which are hidden there or which are north required to share with the tome and collect only those information which is necessary to protect the car and to complete the task. So I hope with this example also you understand about obstruction. So every work which we perform in our life on most same things applicable there there. There are a number of information related to anyone of that work or the task which we are going to perform. But we on the only give emphasize the importance to those data which are relevant, which are required for us, and we complete our work. 7. Abstraction - Realistic Approach: let us take another example. Toe. Understand abstraction. Let's talk about properties off book. So when we talk about properties or book so there can be number of properties off it that is stocked Post a fall title of the book, then, Ah, pages prize quarter D greater. So these are some of the common properties of the book and there can be more, oh, properties off the book. Okay, I suppose one of the student he wants to, but is this book. So on which properties he's going to give importance is going toe talk about the title of the book is going to give importance to Price. Okay, he will not think much about the pages, and ah is going to give the importance to the writer of the book. So these are the things which are relevant or important for the student before purchasing the book. And if I talk about Venter enter, I was going to into the book. So on which properties is going to give importance, which are the necessary proper days off the book which will be required for the printer to print it. That is pages. Okay. Title is not so important for the printer, then, uh, quality of the pages, the color. So these are the properties which will be required for the printer, which other necessary information on which we required before printing the book. So there are number off properties, but the student only collect those properties does informations, which, which is required to him and yeah, ignores the rest. In the same way, the printer also only correct doing for missions which is required to print the book and ignore the rest. That that thing is known as abstraction. So I hope with the example with this example you understand about abstraction. 8. Explanation of Abstraction with Example: in this example here is one of the movie and, uh, the blueprint off. It is the properties in the matters which are encapsulated within the class so there can be number off information related to move I. There are a number of components which work within the mobile, but in this object, but the user of the Movil or the person who is using them a while only collect or together 11 data which is necessary to operate. The mobile is not going to gather the information that how each one of the component off the movie is going to work that is not required for him. Those informations are there. Those may be behind the scene. What is it is not required for the mobile user. He only collect the top most information that I live in it information which is required to operate the movie That's it and ignored the rest information, which is already there within the mobile. That thing's known as abstraction 9. Encapsulation: encapsulation. Encapsulation is a process off binding properties and methods in tow. US included in cab solution is defined as the process off enclosing one arm or two days from outside would to us this the wrapping up off data and methods into a single unit according class is known as encapsulation encapsulation, Which is it close to abstraction? Plus did I ity, but a very simple example. I will try toe explain encapsulation. I will give a real time example with the help off, it would easily understand about encapsulation. I will give example off our own body off human being's body. And, uh, with that all the things are going to cover abstraction class and this entity, or you can say the instance while you can call object. All the things are going to cover if we talk about the organs off human body. So they are number off organs in the human body and they are functioning. Can we see that how each one of the organs are functioning? No, we can't see because there are functioning within the body automatically, but they all sort of quiet. They also act upon some more things then only those organs work if I talk about heart So what? The hard to quite art If I talk about liver So what? This organ required to perform the dusk to operate? If I do think example off hurt that hope it bums want it requests It took wives Two things that IHS blood and box is in 10 or late functions Basically what boxes in then all it functions Now these things are happening within the system within our body we can't seat and, uh, it's it is happening automatically. This person is performing automatically. We can't see it. Why we can't see it Because these organs are the functions which are performing are hidden and how they're hidden That is by the outer part off our body The outer part off hoon be that is muscles are you can call or skin So it's skin what the skin old muscles are doing It is encapsulating or you can say wrapping up our but the whole body and in Denver functions are working so they're number off examples related to encapsulation to bind up or wrap up the things and basically the main task off Wrapping up the thing our main purpose off. Wrapping up the things or to bind up or to back them is toe make them secure. So these organs are secure once they are protected from the muscles or the skin and their function ings and their functioning automatically. So the programming also we're doing the same thing. There will be a glass, and within the class they will be instance variables, local variables and functions. And these functions will work automatically getting the values from the instance variables and these functions are encapsulated within the class. So in the real world, how the things look that is implemented in programming, So I hope you understand about encapsulation. 10. Encapsulation - Realistic Approach: Stone is object and is going to purchase a car, so he ate it. Quiets. Don't most information 11. Ditto are we can see he's going toe abstract information, which is required to purchase the car. So the name at this card to purchase and actions, which he is going toe perform. That thing is known as abstraction and everything. The properties and actions all you consider properties in the behavior that is going toe in capsule it and that is going to encapsulate within the class customer. So in every in life that things are like this in the same person is going to play any game , toe play any game. He's going to abstract the data related toe that particular game, and, uh, the class will be called Class Player. That is, those data will be encapsulated within the class player and the same person that home is going to travel somewhere. So he is going to abstract that that data related toe Bessinger. So those data will be within the class or you can see encapsulated within the class a singer. So you know, in a real world that things are like this head is a movie and the blueprint, the common properties and access off It is here but in the class move by. So these properties in the mad thirds which are related to this object mobile on the abstract ghetto, Or you can call it abstraction and, uh, which are encapsulated within that class were white. So the main person, the main purpose off encapsulating they're 11 data. The top most information is to make that data secure. 11. Inheritance: Now I'm going to cover another characteristics off, and that is inheritance. Inheritance is the process by rich objects off one class. Acquire the properties off, objects off another class. Inheritance provides idea off reusability Inheritance means deriving a new class from the existing class. If I explain inheritance in a very simple world and I'm in a very simple way, then the many off inheritance is that if there is any already existing thing and from the already existing thing, if some of the properties inherited or you consent quiet and a new king is manufactured or clear did that thing is known as inheritors, so acquiring properties from already distinct ing and creating a new thing that is known as what inheritance. I give one of example, and with that example, that things will be more clear. One of the company and that company is infield off manufacturing electronic. Devise this, and already this company's three products already in market. This operation T predicts, are one of them is scanner. The 2nd 1 is ah, bring the and the third machine, which is already in market. That is for the copy. So already they're selling these three products in the market. What? The company think that lettuce manufacture a new machine and this new machine will be having the facilities off all the three things this new machine will able to scan this new machine will able to print this new motion about two do the operation of photocopy. So they part of boat a new machine which we can see seen one machine which can perform all the three operations between one machine. Now, will it be a difficult task for that organization to do this? Obviously not what they will do, what this organization will do. The already having that seem machines the scanner, printer and photocopy. So what this organization will do it will inherit or you can say choir or because they derive the properties off the scanner and, uh, it will acquire are you can derive the properties off the printer machine, and it will also did I have the property that the photocopy machine and manufacture our new machine. So it will not be a difficult task for the ordination. And this thing is known as what inheritance so deriving properties from already existing thing and creating a new thing that is known as very vision audio quality inheritance. So there can be no more off examples off it. We are going to see those examples, okay? And, ah, we are going to implement that inheritance in our programming. Also, here's one example off inheritance here is one of the class Simpson. And here's where the class Nokia They have its own properties and methods, but some of the common properties and mattered. These two classes inherit from this glass more way and the common properties and methods which these to both the classes are inheriting. Or you can see deriving. So you can say this is the parent class and these two are work child. Plus. Okay, so this is the example of inheritance. I hope you understand. Thank you. 12. Polymorphism: polymorphism. Baltimore fisma means the ability to take more than one form. For example, consider operation Off addition for numbers, the operation will gendered a some if you take an example. Suppose if I have to at two numbers, that is two plus four. So I will get a new result. A new number, that is six. Okay, but if I apply the same operation on strings than the operation will proceed or you can see excellent produce after proceeding 1/3 listing by concatenation. So it's not going to give a new string. But the two of this thing are going toe concrete in it. So the meaning off Bunim office is that our patient will be seen. The operation is going toe with the same. But after the operation, you're going to get different results. Here is one of the example the operation is to draw when there are four sites and you draw the four sites often object that will be called square. When you are going toe, drop an object having the three sites that will be called triangle. But the operation, it seemed that is to draw. And when you will draw in this faith it will be called What circuit? So the operation is seem and you are getting what more than one deserts more than one different results. That thing is known as body more fisma. So we are going to implement this character stick in. The program also will see this that how to implement this characteristic but in the program when mornings, the example and uh example related to real life we're all having makes you. Or you can say, the mixer in kitchen and the purpose off the mixer is too. Mix the things so the operation is to mix or you can say to grind. So when you use solid things within the Mixi or you can send a mixer, it's makes it. The operation is seem drawer dates and provide that result where ones who changed the things in spite off food, grinding solid things. You take fruits and changed the blade also off the mixi and once you makes it, it gives you a different result. It provides the juice so this characteristics is going to implement in the programming will see that hope it is going to implement how we will implement it. I hope you understand what this parliament polymorphous Thank you 13. Function: Hello, everyone. This Andy Today I'm going to start a new topic and that new topic is function. Ah, function is a self contained block over statements they performed dusk. Ah, function is a set off cold which is referred go by name and can be called at any point in a program simply by utilizing the functions name. When I talk about function and if I want to explain function in a realistic approach, then function means the performer dusk. Suppose I have to perform our dusk, so I have to go through some steps. When I when I will go through those steps, then I will get the result. So performing our dusk, going to some steps and getting the result that is known as function for each task which we perform. There is a procedure and through with through dead step by step, we go through it and we get there isn't the same thing applicable in the programming. Also, no function Classy fired into two categories. The 1st 1 is a pre defined function, or you can call it library function, redefined function or Enbrel functions. For examples, ask your defection. Celera sear function. Who's defining is already within the system. You don't have to define it. You don't have to write on step by step, the instructions for it or the logical steps for it. Everything is already defined related to this function that is known as pretty fine or Enbrel functions. The 2nd 1 is user defined functions. Define off this function is by user, so we are going to define this function. The user is going to define it or we can say the programmer is going to define it. User can give any name, toe the defined functions, so as we used to give the name off the variable the same way we can give any name. So the user defined functions? No, why? To use function? What is that he's in behind it. We are making up around in one of the function and that function is main function, each one of the step off the program, which we right be right within the main function. What is that he's in, or why we are going to use more functions within the main function. We are going to use user defined function with within the main function to explain it to understand it that wide to use function. I give one of the realistic approach example so that things will be clear. Supposing one of the nation in any one of the ordination. There's only a single employee and no this employers to men. Is that going to work this employers? Too many sales work. This a call this employers to manage reception work so a single employee is performing more than one does. So naturally, the task will billon de and Lord off. Complexity will be there. What is the battery? The battle. We will be like this. An organization. They will be one of the employees who is going toe. Man is the won't work. There will be another Employees who was going to many is the sense fork, and there will be another employee who's going to manage the reception will. So in spite off one employed there, there are three employees and the three employees er managing the task. And there's one morning pray that his manager, who are controlling all the three employees So these dart is our detection and Richard in a real life, the things work not a single play, but a big task is divided into routine in subroutine and more than one employees performed the work. But by proper coordination, I structure formation is there and we get the results. Now the same thing is implanted, implemented in programming also. So what Know what we're going to do if there's a big task? If there's a big program, if there's a big project, so we are not going to make this whole big program inside the main function. But within the main function, there will be some more user defined functions, and a big task is divided into a small, small task. There's a coordination between Asian of which one of them and and the results are going to opt in. If we understand in a real life holder things work. The same procedure is adopted in programming. Also, if a content has to do some work, the control will be passed from the minister to the content and not only the control. The argument will also part passed to the content the important instructions. Those also will be passed from Malaysia toe content. Once the control will agrees to a content, the content will start it work. My mother will be having its own like a space to do the work. Ah, content will be having its own work to do the performed the work to do the work. The content is not going to work in many managers space he, he or she will be having its own came into the door. Once the work will be complete the control with these back to manager The same thing will be a plea given for the sales person. Also, the control and argument really passed from the manager to the sales person. If the sales person will be having its own keeping own workspace to perform the work was the work well, do perform the control and the result will be all the result will be passed back toward manager and many there will be having its own workspace toe perform the task and the same thing when we applicable for reception. Whether receptionist Oh so So in this way, in the real life, the things work okay each what we can call it a single function and it's having its own workspace and its own tools to perform the task and the results hoped in. Send a program me also what we will see. There will be a main function, and within the main function it may be possible there are more than one user defined functions, and each one of the function will have its own space to perform the work and it it will be having its own the sources. Or you can see variables to perform the task. So it's having the own space own. And why meant to perform the task so that these three are the user defined function, and we can say that is the main function. So main function is going to call to the user defined functions. As a manager is calling to the content controlling the argument, it will destroy the user. Different function as from many of the things were passed to the content in the same way had a control and I we've passed the defined function. The work will perform and again the control abilities back toe I mean function. So we'll see this in our next video. Thank you 14. Program on Function - I: Hello, room? No, I'm going to explain one of the program, and this program is ah, addition off two numbers. But I'm going to explain this program by use off user defined function. So what other steps? So which are user defined? Function works and we get the result. That is, understand does the main function. And there's the workspace off the main function. The main function is having two variables A and B, and this is the workspace off user defined function, ABC so you can give any name to it. The main function is having its two variables and B and the value which is there inside A and B's, that is four and six. The main function calls. Or did we considered schooling to a user defined function, ABC. But the variables A and B So when the main functionally called tow this user defined function, ABC, the control, the just without ABC function on a defined off. It is the here in this space. Now, this ABC function is having its own variables X and y. Okay, So once the calling will take place once the main will call toe this so usually find function, ABC the value from is going toe Pasto X The value from B is going toe passed away. Now A and B are known as actual argument my x and y unknown as formal argument. So from actual argument, values will pass to formal arguments. The variables off ABC is there. Defined function operation will take place before will be added to six. Result is stored inside Jed which is the variable off ABC. And from here this king, the result is despaired on this cream was the work is performed, the control will reach back to main function. So this this will give you idea that what is the procedure? What are the steps so missed? A whole program will go as I have explained the example off real life given a real time example off, many other in a content all with the same steps on acting, you know. So as I explained that the manager would call to the content then the control from manager Well, these two a content the content is going to work in its own workspace. Then the control these back toward manager. Same thing is happening here. Man is calling to ABC so we consider maintenance manager and ABC is a content. The main is calling toe ABC control this to receive that defined function. Workers perform and control this back to me. Okay, so in the next video, we'll see the program off it. Thank you. 15. Program on Function - II: Hello, everyone, Not really. I'm goingto start making programmes off functions. So there's the first program toe input to numbers and add Put the numbers. It's a very simple program, but how to use user defined function for that, I'm goingto take this a simple program. So the first program I'm going to make can put two numbers and and put the numbers This will be the first puro which I'm going to create that mean crude. First, a phoned ahead or fight using name space past two D and save the program one. So you were named to it C plus function prg one cbb. Okay. And, uh, the first thing which I will do is to declare the user defined function for the declaration are the Syntex will be It will be like this. So I'm giving the name ABC to the user defined function and the two argument is going to pass often teacher type. So I have given here the data type into inside it. Okay, so this is their declaration part of user different function. No. Inside the main function, I will take the variables of the main function that is A and B and I will define the values off a Okay, Where does define as I have explained in the diagram, the same values. OK, so do that. I grow many is having two variables A and B is having core. And bees having six letters give the same values is having fooled. Okay And bees having six? No, the calling part. So it's going to call this able to function with the variables A and B. Okay. And here I will apply what you've done, Geo. So this block is off main function. Okay, this one? No, I have toe make the block off user defined function. So they user defined function is what ABC it is having to variable x and y and one of the variable were resulted. Really welcome. So that equal to x plus way and the result of value is inside the jet. So here I would like to go. That is, that is like this and the values inside Chip. And then what? We're done. I'm sorry. Then the control concerts up to here. So this space or you can set this block is off user different function there was forced to save and and see is it working? Final note. So there's no editor. Do you energy a warning dissident and it's despaired that is entered value. That is what 10. Okay, so it's working fine skin. It's giving the correct result. No. Quickly. Understand. So I have explained the things in a diagram here on the same way that things is here also, this is their declaration of user defined functions. Okay, Was defined will be done by the user. The men is going toe. Or so this user defined function with the variables A and B. Okay, So in the main function, when the main function will call toe this user defined function ABC, the control released to this ABC function okay, and the value from a balloon past two x so they went for is going to pass two X and from B . That is what six that is going toe passed away. Now there's one more extra variable off ABC function that is dead. So the values are added four plus six and result in value 10 will come inside and then it's going to display on screen. After this, the control will respect to me and the program. Berland. Okay, so the same we as I have explained their diagram the same steps out here also in a program . So I hope you understand the program the next we will understand something else. Thank you. 16. Classes & Objects: Hello, everyone I have explained about plus an object in my previous video, and I have explained about class and object by giving realistic approach examples. Now, I'm going to explain programs by use off class and object. A class is way to bind the data and its associated functions together. It allows the ditto and functions to be hidden What his object object is Instance off a class. So I have for explain by giving them a lot of examples off a realistic approach in my previous video. And I hope you understandable for this class an object. I'm going to implement it this corrected sticks and, uh, programming. So let us start. I'm going to explain the first problem that is, to calculate and display one who mosque you bite and I'm going to make this program. I use off class and object. So what I will do? I will first explain the program off glass, an object in our diagram, and then I'm going to implement that program in C players. So when I will explain the program with the help of her diagram, that will help you. I never explain the same program in C plus So the program is what to calculate and display the volume of core Boyd offic you Boyd? No. Whenever we have to make the program off class and object, the first thing which which should come in our mind, is together necessary information together that produce an accident related to the task related to the entity related to the instance related to the object. Whatever you see for, uh, the task to be performed together it and to encapsulate it within the class, that is the first thing. But you have to do while making the program off class an object. So as I have to calculate volume off Q Boyd for that I will gather the necessary information. So what? I will be required to calculate the volume off white. I need three variables. So if you see I have taken here three variables l e N b r and S t this tree, then I required some functions to perform the task. So here I have taken one of the user defined function by the name of Sedita and I have initialized the really off any nbr arrestee. I have initialized the value off land breadth and height Okay, so Lent is nine. Breath is five and Itit's too. That is, any slides within the user defined my third side due to one more function I required, and that is to calculate the volume. So I have taken a local variable V and we cost onion Toby are interesting that is calculated on its told inside we. So all these things I have encapsulated within the class Que Boyd. So it's same as I have given example off one of the customer that is storm. When I have explained the theory off poop, that dome is object and he gets the necessary information to purchase the car. Okay. And those necessary information which together to purchase the car encapsulated within the class customer The same thing is happening here the same. Our detection is here also. So the first thing is to together than a certain formation that is required to calculate the one off. Avoid so that is gathered. The three variables l e n b r and S t had two other functions. Okay. And that is encapsulated in the class Kilroy The's tr instance. Very but And the instance variables are very buzz that can be used by all that mattered. So you can see all the functions which are used but in the glass. So the glass name is good white and the the three instance variable on the three instance variable are use or operate within a set data and also within display later. So if you see the use off, alien br Esty is inside Saturday and it is also within displayed it. My head is ah, a main function if you'll see and we know that always the program starts from the main function How the object off the Klasky white that will be created for that laughter riding in this rinky Reut and hard one. So our one is the object and killed by his class to kill body The class off instance are one Now we're going to work for this are one object for this que Boyd and the name off It is what are one. So how the things will work a mean function. The main function is going to call to the sad data function for our one object. So when the being function will call toe this user defined sedative function for Ivan object this open. Don't operator will take the control where the sedative function is defined and the savior . The function is defined inside the glass cube Boyd. So the control will reach here. The values off the instance variable and it sliced. And the control will these bad. To me, it is, uh, the same idea picture as the term goes inside the shoe. And first of all, he reached to receptionist. Receptionist completes the formalities, and then the control is back to the term. And then Tom again go to the another, employ maybe to the content toe do other formalities so that another content feel completes work and then to the last to the sales person. With the help of Richer, he will take the trial of the car and, uh, after taking the trial, hey, do the other form days and budget the car So the tea implies their substance accountant and this is person the other functions for the object tome they're looking. And after complete of the work that Tom come able to put you the car the same floor, The same floor is here. Also, the main function called the secular function for the object are one controlled is to the secretary. Work is performed on the control of the series back to Maine. No, the brain function we'll call to displayed it a function for our one object. Once it will call to display a function for of an object this got Operator will take the control where the discredited is defined and it is defined within the class. Que Boyd. So the control well least toe here and the calculation work off to calculate the volume off your boy that will perform deserted really will be stored inside V and from V the resulting values going to this parent scream. So this is the flu in which the whole operation is going to perform. How calling control passing and, uh, operation how it is performed that I have explained for the object of one. No, I'm going to remain this program and C plus in my next video. Thank you 17. Program on Classes & Objects - I: I have explained that how to can create and display the volume off. Q. Boyd this program with the help before diagram? No, I'm going to implement the same program to calculate and toe display the volume off Q Boyd in C plus plus. So how to do this in the sea? I'm going to make this program and court blocks the first thing which is required when we make the program off class and object is together Necessary information related to the task which is to be performed. So what we have to do we have to calculate and display the volume off a que Boyd and to this and to calculate and to display the volume of key Boyd. For that, we have together the necessary information and then we will encapsulate it within one of the class. So this thing we have to do so to start making the program most of all, I would include Io stream and then using name this piece, a study gonna save it also, I will goto file then save You were named toe this C plus I checked. Does the name Dort doubles? See, that will be extension. No, let us make a class. I'm going to make one of the class my name off white. Okay? And within this close, I use a keyword public or you can see assess mortar fire. Now you will understand about this is 40 fire when I will when I will cover the topic. Inheritance had the time. I'm going to you so public, Private protected these assets modifiers, then only the things will be more clear. Okay, so I'm going to take three instance Variable l e N b r and S t. And, uh, I will dig one of the user defined method by the most data. I will initialize the value off alien we are for the bit and nasty for the height. Okay, Like this, I will take one more function that is displayed it up and the same functions I have who I took in my Daggett. Almost so, which I have explained before this sir program. So the same very was heros I'm taking. So there's a local variable because toe alien and to be are in tow has steep to calculate the volume off. Avoid the centre value is inside. We I would use here and and you a message William off for Que Boyd is like this. And what room is inside? So everything is encapsulated within the class. Que Boyd. Okay, Are these three variables are known as instance variables All you can call it deter members . The other two functions user defined functions surgery die in this predator. You can call it also data member functions. So the two of the functions until the variables which are encapsulated within the class Que Boyd, which are required to calculate the volume off for a bite. No, What I have to do, I will take the main function. And inside the main function the first thing which I have to do is to clear the object off class que boy because we have working for them or an instance for it for an object. So cute boy is the name of the class. With that, I will lose what are ones in this way out of what is the object? Okay with the arm and I will use Daut and I use what he has said data to function and our own daughter on display data. Another function and had having to you. Don't you I will say the full room and I will see if there's any other or not. So there's not any other that has run the program. I despaired. The volume work you Boyd. There is what 90? Okay, so everything is fine. So how the things were, how the flow off program that I have explained their Dagenham, It has understand one more time this the class que Boyd. And for a single que bite, the data members and remember functions are encapsulated. Here's the main function, and inside the main function object is created by the name off our one off Klasky avoid. Okay, Now the main function is going toe called tow. This said data function for the object are one. So when main function calls toe this Sedita function with the help of food or dot operator the control ditches where the said that the function is defined, that is inside the class. Que Boyd here and the value off Ellie nbr NST initialize is and was the work off. Sedita completes the control ditches back to me. Now the main function will call toe this predator for one object. The define of the surge ETA is there inside the class, que Boyd, the daughter operator, helps to reach the control. Whether displayed does define. So the control will reach here. Calculation awful to calculate the volume off white that is completed. And it is displayed on the screen and the control these Becker into the main function. So in this way, by the use off class, an object the program completes and we get the result. So I hope you understand the program. In the next video, I will explain another program. Thank you. 18. Program on Classes & Objects - II: No, no. It has understand the next program that is to calculate. And despite the volume off, provide bypassing arguments for the first program picture we have understand and that we have not used the arguments we have simply and he slashed the value off, for instance, variables. But here we are going to use the arguments. We are going to pause the arguments. So how to Basel grants and how the calculation off kilobyte That is the one you work a white that will be done. We'll see that. So I'm going to make the second of a program that is calculated and displayed the volume of carbide bypassing argument. First of all, we understand this program with the help of her diagram. Then once I we will understand the program with the help of for diagram, then we will understand the same program in C plus plus. So it is the second pool room and let us understand first of four with the help for Bagram . So within the class, que Boyd were having three instance variable Elian b RST and to use a refined function when it said it out. Another one is display later, but this time. If you see inside the Sedita, we are having the local very was L B and s. Okay, so everything is encapsulated within the class. Que bite he had inside the main function. One of the object of one is created off for class. Que Boyd and the X fire jet. Other local variables off main function. Okay, so main functions very bazaar X Y, dead and upset did a function. The very was R and B and H Okay, No, I will be the full off room near the sea. What the main function will do. The main function will call. So this center the function and once it will call to the Saturday the function the controlled release to the sedative function which is here inside the flask. You bite now with the control. The values are also going to pass from acts from this local variable. The value is going to pass to l. Okay, a local variable offset data. The new value from why which is the local variable off mean that is going to pass. So the B variable be local variable offside data and the value from the set that is going to pass to edge. So from these variables, the values are going to pass to the local variables. Offside data once it will leads to the local variables. Offside data from l the values going toe Pasto the instance variable alien from B. The value is going to pass toward BR and from edge. The value is going to pass toward S T. In this way there work off started I will complete control abilities to mean on what the main is going to do. The main function is going to call another function that is displayed it up for the object Arman. And with the help of this daughter operator, the control will least whether discredited eyes defined and it is defined inside the glass . Cue Boyd here the calculation work will be done resulted. Value is inside we and from we the resulted value is going toe display on screen. Okay, so I hope you understand how the values are passed, how the argument side pass and the calculation work is completed. And, uh, for this often in the next video, I'm going to make the program in C plus plus. Thank you 19. Program on Classes & Objects - III: Hello, everyone. I'm going to bring the program in which the argument arguments are going to pass. And the program is this second number that is calculated and display the volume occupied by passing arguments. So let us see. I'm going to make this program, save it, not save the file, making the name of the file within the class. Que boy first of for I would take three instance variables. Okay. And I will take one of the user defined function with local variables. But these are the local variables off the user defined function and from local variables. The values are going to pass to the instance variable that we will see when I would execute and explained the whole room. Another function is despair, data function. We can give any name to the user defined function. So there's a function displayed it up inside it. I take one of the local very will be on with that freak Australian and to be our and dost the volume off your body is going to create William off you, Boyd his like this. And it isn't, say the V, so it's going to display. But this time I've taken the local variables. Also inside the Sardinha? No, Inside the main function head, what is required is to create the object off Glass Cube white. I would give a name to it. What are the one? But that I will take three variables. Also, X Y jet for land with and height. I give. I hear a message. Also. There it is in poor land. Good and height. Que boy. Okay, so I'm doing a message here on duh. With the message. Yeah, You're seeing sort of values with Green X. Why on inject? Okay. No, the car calling part for that Harman door. Sorry, doc. With X Y and dead then carbon door on display. Do that on the last word there. Done too. Let me save the program and compile it. So there's not any other in the program. Everything's fine. Run the program and it's asking me the length, width and height off Avoid. So let me give it nine, then four and entry at President Cookie. That can created the wall in Kuwait. Okay, so it's OK. There's Nordea Nieto. So how the things were right? Just quickly understand the program is going to start from the main function object off Plus you avoid that is created by the name off. Our one t very was three local variables X y and yet the C local variables off main function The values are store X for the land. Why, for the real injured for the height, what the main function is going to do, this pain function will call to set it up with But it was x y injured. So once the control with these two sad data for the object are one hit the values that is from X, that is going toe pass to hell and the value which is there inside. Why that is going to pass toe be local variable off Saturday now and the value which is there inside Jed that is for height that is going toe pass to at another. Values are inside the local variables offside data But from el that values passed to the instance variable alien and from B novellas passed to be a and from edge to the instance variable esty for the instance. Variables are those variables. Rich can be assessable but to all the functions which is used within the class so these variables will be assessable inside that display. It also, if you see we have used. Okay, so these variables are not for a particular function, but there are. These variables are for all the functions which are encapsulated within the class. Okay, The control from sad data that is going to these back to mean Okay. Here. And what the meaning is going to do is going toe called what displayed it out. Once it will call for the spread it out the control Will these to discredit er calculation work toe to calculate the volume of your voice. That is, that operation is performed and the results of value is Is inside the V with a message for Luca wide resulted value display on the screen. So I hope you understand. Understand? The program Does the program to calculate the volume off? Avoid? Thank you. 20. Thank You !: Hi. If you felt any difficulty understanding any topic during the course I'm always available to please feel free to ask me. Thank