Object Oriented Programming in Php (OOP)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello guys welcome back in this video I'm gonna teach with you object-oriented programming language and PHP before working on practically on object-oriented programming language we need to know what is and how to work okay so the old concept is a we can imagine this is the first line okay we can imagine our universe made of different objects like Sun earth moon it is similarly we can imagine our car moves car mat of different objects like wheel still there it is same way there is a object-oriented programming concepts which assume everything as an object and implement a software using different objects this is a class basically class is an object for example in the real world car and also table are objects okay and those are basically identify of this car number color behavior and this data represents my travel agent 'ti travel color table behavior right but in programming language I want to use car objects so I need to make a clock with the name of our okay you can change the name you can do that and you can write any image you like in the class but the best way you can use the same name like class car kids and those are basically date of the car I mean identity this is identity number the state color wheel it is so I will use class inside the class I will make member of the class I mean variables you know guys variables inside the class I will make up variables it means I will define the parts of the objects like identity will how many wheels available in the car for okay color and many of that and behavior this is a behavior this is a last one is a behavior so I want to use behavior in programming language so I will make up function or method you can say any name as you like but the best way is you can use method okay inside the object-oriented programming okay so the best and important terms of object-oriented programming languages are class you must be define the class any object you want to convert the any object into programming level you need to define the class once you have defined the class then you need to make an object of this class I mean each class are specific class then you will define the member variable inside the class you will define the variables those car member a member function you can define the function inside the class those are member function okay and inheritance you will define the one class then you will connect it specific class with another class you can use inheritance parent class child class and many other important terms available on this page I will teach you step by step practically in with different examples so I hope your industry evolve thank you very much for watching see you in the next lecture hello guys welcome back in this video I'm gonna teach with you are we can define a class how are we gonna make object of the class and how we can define that member our variables inside the class how we can call the member outside of the class okay so first this is a file the name basic concept or PHP this file I have made inside for us okay then I just leave that okay so I want to define the class in the tax laws this is a comment okay define the class just write a class Keever into the class name I write class name cops still vacant this is your class inside this skill break card you will define the variables are you can say that member of the class okay so I want to define the member remember the class variables in normal PHP we need to define the class variables using dollar sign and this way right color this way right but in the object are ooh language you need to write that public before right the name you need to define the perfect this is the access modifier I will teach you to tell completely details of each access modifier and how you can use that but this time you need to know basic knowledge of object and that programming language right so this is a my class inside the class however two members are two variables said that I want to call this class so you need to go outside of the class this is a closing SP decade of the class then you need to define or make an object of the class make an object make object of the class okay so you need to define the variable you can write any name as you like in my case I use cars data okay then use HL sign new keyword and class Smith the class name is the cars entities termination after creating an object then you can call cars get a variable to call the member of the class and also assign the value of the class I mean member okay how that's very simple a car cause a member of the laws and assign that good okay so we need to define the I mean call the cars underscore theater - on greater themself it means we will use inside the killer's data like a member of the class are variables I want to call cops car just right car name okay as you can see con I do not assign the dollar sign just a white car name and assign the v85 example BMW I want to display the car name on the browser so you need to define the echo statement said that open this file on the browser let's check it as you can see guys right now I use same process copy that as I read it come and be a trick then I paste the same code I just changed the second variable name like color said that and then open the browser a feather pitch as you can see guys BMW black okay inside the class there were two members I mean two variables I do not assign the value inside the class okay I have assigned the value outside of the class okay you can also define and assign the value inside that kill us in the variables I can move that okay and I go to class send a very BMW like so that I do not assign the value outside of the Kellogg I just called the member of the class okay BMW black right as you can see BW I am okay sorry guys okay right so you can use any one method as you like in my case I just assign the variable inside the class and i will call outside of the class and also send a value outside of the class okay why I will teach just a minute be an ugly so like if I have a sign in the value inside the class inside the killers and variables then I just called the variable names and member okay you can say that also object name okay and member names are variable names then you will see specific data on the browser but you have defined the just our variable inside the class then you will use many times with different ways for example I have just a sign I mean I have just a mid object of the class one time and I have called the variables inside that kill us one time okay I just copied that and first I used I passed the same I just a change the name file from addict right to time second second time called class members or variables and assign the right copy that best air third time and change the name like which guys Baxter daddy right all at one time you need to make an object of the specific class then you will use the specific variable R object of the class to call the inside the class members inside the class functions you can call anyone outside of the class itself that and go to browser refer the page right you can see BMW black or the white Ferrari effect you can also say that value for example I want to send in together I can do that and color babies my entire office said that right so this is a simple way to make chaos inside the class have member of tequila I mean member of the class are variables how you can define the object outside of the class how you can use specific or particular object names to call the inside class members variables are member functions this time I do not use the function because I will teach you on later this time you need to know how you can call the member of the class or variables okay so I hope you are mr. days well thank you very much for watching see you in the next lecture hello guys welcome back in please lecture we have discussed all about the last object and also member of the class arm variables in this video I'm gonna teach with you functions also function with parameters how you can create a function inside the class how you can call the function outside of the class or you can create a function with parameters so I'm gonna create a file another new file functions beach right the basic syntax and hope you just have a single class to set the time okay said that and close basic components now let's get that inside the class I want to create a function make up function you need to write the public keyword function keyword enter the function I write function name run alright simple echo statement you can write anything else inside the function you can create a loop you can create an array you can write anything else inside the function right in my case I just write the echo statement car is running now okay I want to call this function outside of the class first you need to make a object are clear a variable and assign the class okay so I use I just write car okay chill new class name class name is the cars right mmm make object then call class members and also function I just write the car - fine get rid of that side and I call car name BMW you know rice car car color okay I need to remove the dollar sign because I don't need to use dollar sign car color is white okay I want to call the function call function so you need to write the same way dollar call when I sign greater than sign and function am the function name is run parentheses Terminator sign right said that but we need to use eco statement to display the data on the browser and the member of the class okay you know guys this is a member this is the member you can say that also car variables let's check it now I just remove that I will use function dot PHP which file never the functions head and as you can see guys BMW white car is running now this is a function data and this is variables data right I want to create another function so just right public function stop car is stopped he said that and I command first it and I called car stop function said that and open the browser to for the pitch car BMW car white car is a stroke yeah so this is a function you can use that inside that the last and how you can call the outside of the killers right now the next thing is how you can create a function with parameters okay so I will create another file because this is a very important to understand each thing which available and the OP language in PHP so copy that give it another file function and s call para dot PHP there's the complete code and the multi-step file okay function like a function with better meat remove the another function like store okay and also I want to remove that just to write the basic knowledge of class members and simple function okay inside the function first I change the name of the function data okay inside the dentist I want to pass the parameter I just write the variable name okay you just write any name as you like in my case I use dollar and comma dollar C right you can pass different parameters one to five time many parameters you can pass that okay inside that is Cle bracket I call car name above variable this variable and assign the value and okay and I can call car color assign the value C variable right then this is the parameter function so we need to use return keyword and I want to return car underscore name variable concatenation sign make a space [Music] car color okay Terminator sign okay outside of this clip decade you need to make a variable like a car's data new class man right and function with era so you need to call cars underscore data then brackets minus sign greater than sign and function name the function name is a data you need to pass two parameters so I want to pass BMW comma white okay this is a function written back with as car named car color okay so I want to display the date on the browser so I make a variable because this is the return function so I make a variable and assign the complete function and also object name in the data variable then I call Oh data let's check it now set that and refer the patch as you can see everything is the same on here you just need to pass the parameter and after creating a function with parameters then you need to make a one time object and just a call function okay okay now the next thing is I want to assign the text I can do this I use the prepetition your car name is and ul car color is save that I fade the page okay just a minute [Music] the colony is just a minute to just of your car there is okay this is a okay so you guys this filename is a function para gear sort of a debt function underscore para dot php' as you can see guys your car name is BMW your car color is white if I want to use the please wear like return this way you will see the same data in just a minute that this is a concatenation sign and this is a double quotation it will make a space between one and second text clip serve that refer that right BMW white so this is a way to make function with parameters and you can use that to perform the different tasks so I hope your understood as well thank you very much for watching see you in the next lecture hello guys welcome back increase lecture we have discussed all about the function and also function with parameters in this video I'm gonna teach with you how you can use this keyword inside the function to call the class members and also assign the value right so first ah I make a function and introduce public inside the class right public function my fund this is not function name and I pass the parameter like a then I want to call the class member variable inside that class inside the function I need to use this keyword dollar this means I want to call the class member variable and I need to use minus sign greater than sign then you need to write only variable name without dollar sign car name I assign the value a and this greater than sign car color without dollar sign and pass the second parameter like B then this is the written function okay I want to get the data from this function so we need to use return keyword in the return keyword you need to write return then dollar this car name on catenation somewhere in double quotation make a space between one and second one concatenation so in total this second variable okay this is a way to use this cleaver inside a function I will call the function outside of the class or VJ - to new class name cause or VG my phone pass through parameter for example I pass the my PHP programming I need to use echo statement to display the data on the browser right cell that after that as you can see guys okay so this is a very simple way to use this keyword now another important thing is and it is lecture we have discussed all about class member variables right and you are able to see the class member variables available inside the class why I have assigned the variable inside the class because I would use them many times inside the class without creating more variable inside the function right why I will teach you of the function test a second time I test that only third time I've used those variable inside the one function and I also change the function name second and third I also use the above variable in the second function okay just need to change the parameters yeah okay this is a malfunction in one my fan in this function I have a two parameter with the name of a and B I will call this function we need to pass two parameters the parameters really we'll assign in the car name variable and also car color variable then I use written keyword to get the data from Cornell and call color data okay now this sanely available in this second function and also third function I just used a bow variable inside the functions okay I will call the function second function I'll copy that test by the second function name and I saw what programming I need to use be our Tegrity this is my second function and for my fun one copy that paste her and seashore program cookies serve that in the browser for the page as you can see guys PHP programming Java programming seashore programming only you need to make a variable inside the function I mean inside the class then you will use them and set a function okay just assign the variable inside a class so I hope you are understood as valve thank you very much for watching see you in the next lecture hello guys welcome back in this lecture we have discussed all about this keyword in this video I'm gonna teach with you static keyword how you can use static keyword to make a static variables and also static functions first I want to call the normal this is the basically normal variable I want to call the normal variable outside of the class so we need to make an object to call normal variables are members I call obg children new cars and I call ODG and I call car name assigned a value for example BMW right then I just write the cout statement copy that best hair white car color okay ii vdl right serve that and for the page car name okay just a minute hmm Garden in Calcutta just a minute right BMW white I don't need to use dollar sign after calling the object I mean after calling the variables class variable outside of the class right so I also use h2 normal the normal class variables right so that turn yourself that okay now I want to make static variables so dirty in variables you need to write a public static giver then variable name for example user public static you know if I want to call the aesthetic member or aesthetic variable outside of the class then I don't need to use object are I don't need to make an object to call the aesthetic variables outside of the class if I want to call the aesthetic variables outside of the class we need to call the class name and also I will use the directly static variables like user user in mom let me show you the example a copy that and I use first I usually call in VR tech based accord static class really okay so I want to call the aesthetic variable and also assign the radio so I need to use classname cars Colin Colin after using double Colin then you're able to see two variables has been have been appeared in the drop-down menu I want to call email and the static variable you need to write the dollar sign also kay I want to use email admin at the return line Tai Chi toots dot-com Terminator sign I want to call the another cards Colin Colin user Kurama best right this is a my static variable and also second static variable serve that and open the browser for the page okay we need to use the constant medical system manager Sir that and refer the pitch the program up this is my username admin editor at online attitudes this is a my email okay this is a call static variables using class name okay so this is very simple way to make a static variable and also call the static variable outside of the class okay now next thing is I want to make a static method first I write the normal function or method I just write the public function my fun and inside that I just ride the coaster man normal function I want to call this function so I need to use I mean I need to make a object then using object name our variable name we will able to use this function okay I want to call the function so I need to use obj minus sign greater than sign and function man first set that open browser for the page just a minute Oh BJ and the first character is a large okay d mwy normal function right if I want to make a static variable function static so you need to write the same thing like public esthetic then function Cheever and my fan man this is a my aesthetic function stretchy function if I want to call the stating function then I will use same process I will use our class name I use just call the function then I use simple class name carves : : here is a function in my phone one said that and open the browser refer the page as you can see guys a static function that has been appear inside the browser so you want to create a static function you need to buy the static keyword okay now another important thing is I want to use the static variable inside this function I mean inside the aesthetic function normal function in normal function I want to call the normal variable inside the normal function so I need to use this keyword okay and the car name okay like this but I want to use the static variable inside the static function so we need to use salt pollen : and your static variable like in user solve Colin Colin you know right I want to use the written keyword return self : : user concatenation sign self self Colin Colin email said that and let's check it now I will use I need to also sign the value inside the static variable because I want to display the data on the browser be I you user I use PHP and PHP edit online piety cheaters.com save that and I want to use comment ok because I want to use the function aesthetic function and I want to display the data on the browser static variable data on the browser ok just a minute okay this is a written function so I need to use echo statement as you can see guys this is a my username and this is my email this is aesthetic variables data those data has been basically those data a sign in the aesthetic variable then I am able to use the aesthetic variable inside the aesthetic function then you need to write the self self keyword okay and also you need to write the return keyword and self the first and second variable name then just call the function outside of the class like this and use echo statement to display the data on the browser okay guys so this is a very simple way to make a static variable and also static methods or function and you know I have explained you all about normal function and also static function normal variables and also static variables I hope you are understood eval thank you very much for watching see you in the next lecture hello guys welcome back in this video I'm gonna teach with you constructor in PHP you can also say that a special type of method or function okay so inside the class I want to make a constable Oh method then I need to use same process like public function then I want to make a constructor so I need to use underscore underscore construct parentheses still you break it just a minute I remove another extra brackets inside the constructor I want to display the data I just requested man we are using constructor okay I want to display the data on the browser so I just need to make object of the class then the data will appear on the browser this is a car constructor let me show you I'll make an object or variable class name I just make object of the class then the data will appear on the browser serve that and refer the page as you can see guys we are using constructor okay I want to pass the parameter I can do there okay just a minute mmm first I command know I passed parameter then I will teach you another important things and we are learning we are learning concatenation sign and variable name inside the parenthesis I need to pass the value one value I can use different values like integer float and also I will pass different type of parameters 1 2 5 7 many other things I pass we are learning PHP programming language said that and then open the browser or the page and also I want to rule use many time I can do that I use BRD there's the same code just to write the same code and I want to change that see shop programming language let me show you the example as you can see guys we are learning seashore programming language if you want to change the name you can do this cell that a further page right so this is a very simple way to make a constructor you can make a constructor inside the class then just to make object of the class then data will appear on the browser you can also write the loop array inside the constructor then after creating a object of the class then the data will appear on the browser I think I'll need to use recommended domain that because very important to you write public function underscore underscore one start okay and say that I want to use do hi so to zero I less than two to turn PI plus plus values are dollar I write that and just need to come at it too much also commented okay new data said that after the patch right loop your loop values are zero one two three I need to use a concatenation sign dr tag so that as you can see guys right this is a very simple way to make a constructor inside the constructor you will make aloo array and you can do the anything else inside the constructor thank you very much for watching see you in the next lecture hello guys welcome back in previous lecture we have discussed all about constructor in PHP in this video I'm gonna teach me Tod constructor in PHP the constructor opposite of constructor if you will create a constructor then you will make an object of the class the data the constructor data will appear on the drawers off right but in the constructor you need to call the any member of the class or any function of the class then the Deconstructor data will appear on the browser without calling the deccan structure let me show you the example inside this class I make a variable public user and assign the value program right this is a mind member of the class I will call this member so we need to make a object then I call object and variable name user and also you need to write echo statement to display the data on the browser this is a normal way to call the user okay our member of the class right if I will create Deconstructor inside the class then the data and the Deconstructor data will appear on the browser without calling Deconstructor let me show you public function underscore underscore deconstruct inside that I just write the question man we are using the constructor okay as you can see I have just made a variable object of the class and just to call the member of the Colossus I do not call this the constructor or the construct function outside of the class but you will see this data will appear on the browser serve that as you can see guys program we are using deconstruct it will automatically call after calling any member of the class or any function of the class which available in the class section so this is a very simple way if I comment that and also comment that serve that okay after creating an object as you can see object this is the object of the class the data the constructor data has been appeared on the browser okay I comment also you can't see anything else on the browser this is a call the constructor okay so you can use that you can't and an other thing is you can't store our passed the parameter inside that Deconstructor parentheses this is a very important thing you need to know that okay so I think this videos are too sharp this is a very simple topic all about the construct I hope you are understood as well thank you very much for watching see you in the next lecture hello guys welcome back in this video I'm going to teach with you inheritance and PHP first of all we must know what is inheritance and how does work one of the main advantages of object-oriented programming is the ability to reduce code duplication with inheritance code duplication occurs when a programmer writes the same core more than once a problem that inheritance tries to swap in in heightens we have a parent class we have a parent class with its own methods and properties and a child class or classes that can use the code from the parent class by using inheritance we can create a reusable piece of the code that we write only once in the parent class and use again as much as we need and the child classes here is the working process of inheritance this is a class first this is a simple inheritance this is the class A in this class have methods properties right and I want to create another class with the name of B class after creating a B class I want to use a class methods properties are members so we need to use inheritance or extend keyword and class name like it then we will able to use a class methods and properties right now the same way available in the next is a multi-level inheritance there are three parts of init and simple inheritance multi-level and hierarchical inheritance and second our multi-level inheritance have three classes like ABC in the egg class have a methods properties and members I want to use the a class methods properties and also member so I will create a class named B and I will extend the class a after extending the class are in hell the class a then you will use Class A methods and properties the same way available on the next class like Class C you will use same keyword extent and extend the B class then you will use be class are a class methods properties and members of the class now the third one is a heretical in a turn in the heretical inheritance ever only one parent class like Class A two child classes like B and C in the a class have a methods members of the clause are variables and many other things so after inheriting the Class A and B then the a and B will able to use the air class methods and properties so in this video I will teach you simple inheritance how you can use that to display the data on the browser and perform the different tasks using inheritance let me show you the example I go to code editor and I check it my browser so I take a last look at class class II just liberated you can also say that this is the my phylum parent class parent class our main class okay inside this class I want to write the public mmm user right and also I will create a public function my fun one user I mean variable and second one is the function inside the body of the function I just write the we welcome to my website I use concatenation side this user get above variable anyone user will assign the value on this variable then this start and also the receiving text will appear on the browser right after assigning the value of the a our user variable okay now the next thing is the idolater second odd I call child clause okay I call plus P I want to use same process inside this class this is a different I mean I want to use the same thing in the next class like plus B so this is a not good for programming I want to use the same code in the next class so we need to use the in head process are in a future like I call extend then I call a okay after using extends and class ma'am then you will able to use the a class member and also function let me show you and I class have a user and no data in the user variable right inside the be class I call user just right user and assign a value for example I need to use public key but ok programmer okay remember that this is the empathy value inside this Colossus I just assign the variable like user after extent the class a I have assigned the value in the user variable right now two things and the next processes I want to call the user and function so I need to make object of this second class like be class the car be obj be class then I call for example obj first I call user okay I need to use a construct and white and also obg my father said that and in a further page program okay two times we have seen two times okay don't worry our BG user just a minute I called Iowa as you can see guys welcome to my website this is a my member our variable value has been appeared and said the process let me show you the process inside the a-class have a one-member are one variable and I just called the function inside the function I call the member our class variable inside the function then the next thing is I have used extend keyword and class name like a after using extent keyword and class name then you will able to use the specific or particular class data like member or function you can change that anything else you can do that further I want to change the function value I can do that I want to change the user value I can do that after extent the class then you will use the parent class properties like function members okay now after using this process then you need to make a child class object after creating a child class object then you will use the same function name which available inside that parent class like my fun as you can see no any function available inside the be class the my fun function available inside the a class as you can see guys so after using extend keyword and class name then you will use the parent class I mean a class will use our properties like variables functions and many other things ok guys so this video is all about inheritance simple inheritance okay you can say that simple inheritance I also use simple and head chance said that right this video is all about inheritance simple in a in the next video I'm going to teach with you multi-level inheritance so thank you very much for watching see you in the next lecture hello guys welcome back and previous lecture we have discussed all about simple inheritance and you know how you can use that to reuse the code okay in this video I'm going to teach with you multi-level inheritance so I will use class II and say the class I give it a variable public we use then I call function public public function my father right I also signed the value inside the class and then I call the call hey contention this just turnips dollar Canadian dollar this variable name user or welcome to my function right telemedicine okay I want to call this function or this user without and hairy chance calling the parent class right so we need to make an object at the class of vehicle to new class name parentheses then I call obj user okay are I called direct or a function okay more fun serve that and then the browserify the page head programmer welcome to my function right this is a normal way to use our variable and function you know rice okay now after using this method I want to make another class and I want to use the same things inside the next or child class so I will tutor class cannot Claus be inside that I just change the variable name okay first I need to use extent class name is okay and I called the public user inside the next class our child class I want to change the window web developer variable value right child killers are and other laws now I want to just a minute first my command no I not commanded use call HT normal way to use methods are variables right okay copy that and then I use it all in VR tech then I use some code after inheritance I'm dead okay after inheritance the Class A I want to call the function write this function then you will see the user data or function data I will change let me show you the example I call child new class name is second class name okay B class called child - so that and then open the browser refer the page okay normal way to use methods or variable head programmer welcome to my function right after in hydrants data I can't see the rarely changed okay now there is a problem now okay there is a problem as you can see and the first character is a large so we need to use first this large as you can see guys have web developer welcome to Maya function I just need to change the value of the variable right then I use same function which are available inside the a class ok now this is a simple inheritance now the next one is a multi-level okay I call Class C I want to use the be and also see class I mean B and a class methods are variables or property you can say that anything else they call extend keywords and I just need to write the big class name why the declares already extended in the a class it means in the peak last have a variable and function so I want to change the value in the C class this is also child killers I want to change the same variable value for strike drug laptop right said that then after you need the claws be child to us so I copied that there's a class I need to change the class name CC child CC my father okay this is very simple I just and object name or variable name and also I call the same function which available inside a class in the next B and C class no any function available inside the B and C class in the B and C class I just changed the value of the variables like the user web developer user fully-stocked a lot serve that and open the browser let's check it now as you can see guys in the third one - struct Allah power welcome to mark function in the normal methods or normal way to use the function and variables the data is a high programmer welcome to my heart function after inheritance the D class this is a big last value I mean this is a big loss you can say that also charge class then I just changed the variable name I'm in variable value another value is the same just change the variable value and call the function which available inside the a class then the data has been changed now use same process inside the third class like sea glass in the C class just need to change the inherited class you need to change in head class name is a P and also I have changed the user variable value like full estate developer and how the other tax is the same okay so this is a Carl multi-level inheritance inside the a-class have only one function and one variable I have used function in the second and third I mean clause using C and B variable object I am able to call the Maya function which are available inside the a-class this is a called multi-level inheritance right so this is a very simple way to use inheritance multi-level inheritance and many other examples available on the browser or on the web you can sell that to check out your different way to use multi-level inheritance this is a very simple and short video all about must be inheritance and an MA in my mind have a simple and normal way to use multi-level inheritance you can use that to perform the different laws so I hope your industry evolve thank you very much for watching see you in the next lecture hello guys welcome back in threes lecture we have discussed all about multi-level inheritance in this video I'm gonna teach Vicky you hear a chicken inheritance so I will use same example like Class A Class B first I create a class a inside the class I make a variable like user and a sign of AD web designer right then I also make a function more fun parentheses and I will call this variable inside the function and also I attach the text welcome to my site concatenation sign and dollar this the variable and like usually without dollar sign okay so I call object and I call the question man and h3 Terminator inside h3 I call class I make object of the JQ to new class name a parenthesis Terminator son then I call obj the variable I call just function no I'd call first user but we need to use the cost recommend first serve that and let's check it now in the browser Class A Class D top web designer why I call function obj my father said that and web designer welcome to web designer but I command the user then I think everything is perfect welcome to my site web designer yeah I have called the only function inside the e-class function okay so I want to use logical inheritance so I make a variable R Class V and I call extents take loss right first I make a Class B and extend the a class it means the B Class able to use the a class member and functions so inside the B Class I just write the public and called user and just change right then I call the in just a minute I make the class object I copy that and paste it and I make a B obj continue and a copy obj and I called the variable like a user I also use eco statement and also I will use complication sign in the Artic right I make a basically I made the object of be class inside the P class a variable with the name of the user this variable is the same available inside the a class I just changed the value inside that big class and I have called the big class variable inside outside of the class so let's check it now okay I need to change the class just a matter in the a class data welcome to my site this is a web design a user where you are variable very well in this second I don't need to use biotic remote that in the b-class have a same variable value but the value has been changed right I have just assigned a variable inside the big glass and change the value after using extent giver then b-class will able to use the a class functions variables and other things okay now the next one is a okay I check it to call OB b obj my fun as you can see guys this is a variable value and this is the old function value but the function will you also changed I comment this video as you can see guys in the I clasp hello welcome to web designer in the b-class never welcome to my site web developer after exchange the a class then the extended class means B class are able to use the a class functions and also various okay let's create another class like C and I call extend II class means this is a hierarchical inheritance I have extended the class each time a class in the B Class have extended a clause in the C class ever extended a class means this is a call heretical inheritance right inside this I just copy and paste and I change value of the use of and I copy again this data investor and I change the CE CE and I change the I also see right and also see Papa Jeff okay that's a kid now as you can see I see class data welcome to my site full stack developer right this is a call here a chicle inheritance I have called only function inside that this function basically available inside the egg class as you can see my phone but I've used extend keyword and class name then in the extended class able to use the a class methods and members are variables so this is a call heretical inheritance you can also copy that and paste it just change the class name and I change the for example I use digital marketer in the B C and D class have a one variable the variable also available inside the a class like the user I just changed the value inside the B Class C class and also D plus and I call basically I have called many times in the function my function which available inside the a class after calling this function then the user really will automatically change okay a copy again that paste there and change the class name like D D D and D and function f right same function let's check it now welcome to my side digital marketer right this is a called logical inheritance I have used only one variable and function after using the after creating a variable and functions at the a class then I have extended the a class many times and I change Vasili have changed three times user variable value and after the class of the class I make up many objects like Class A object Class B object class C object class D object then you are able to see difference that has been appeared on the browser this is a car logical inheritance right so thank you very much for watching see you in the next lecture guys hello guys welcome back in this video I'm gonna teach with you access modifiers are you can say that visibility there are three major access modifier are visibilities public protected private public means you can use the public key word then you will use the variable functions inside the class off side of the class and also you can use public member or variable with extended class and the protector means you will use the variable function inside a class and extended class will use the protected variable and function private means you will use the variables and function inside the class you can't use the private variables and function outside of the class I will teach you all later the private parking process but this time we need to know the they can protect it so let's start I make a class I called public means I can use the variable of function inside the class outside of the class let me show you the example I make a variable like and assign the video no I just make a variable and also I make a function my father then the variable access modifier is public and function modified access modifier also public right then I use custom and your is concatenation sign and call in this dot user variable right then I'm able to access this variable and also this function inside this class out of this class and also I will create another class and extend this class then I am able to use the variable and also function of side of the class okay first I discussed to make object and I call our bijection to new class name right then I call obj are the variable value and I sent a video web designer after assigning the value inside the user variable then I call obj functional Maya then you will able to see your variable value is the web designer let me show you okay first problem [Music] assign the very web designer obj ok there is a mistake I need to use a per class first character as you can see guys your variable values web designer it means I am able to access this variable inside this class and outside of the class I can also make a class like class be experience a class then I call the public keyword the user variable and I send a video for example web developer and also I just comment that because I call only function ok and also we need to change last night save that and repeat the pitch as you can see guys your variable value is web development it means I'm able to access the public variable public function inside this class outside of the class means another class and also out of the class we need to make an object and I am able to access the function and variables public variables and as public functions right this is a call public public access modifier right so I commit that basically I comment there that's very important to you okay let's talk about protected protectant I make a class in and I call protected this is the access modifier and Holle user assigned a value for example web designer and I called protected function concatenation sign and this variable name like user okay this is a protector it means I can't use the protected variable and also function outside of the class let me show you I make object obj Caltrain you and class mail and I call obj and a call user for example and also I use echo statement okay I assign the gradient side the user variable it means we are able to see the web designer per the access modifier available inside the user and function variable I mean and say the function and the variable hewa protected it means I can't use or can't see the video on the web let's check it now federal context is probe protected property right it means you can use that inside that class okay now another thing I want to access them now the two things there are two main things I create a variable like public this is the access modifier public okay you need to write a public access modifier then I use function my no display inside the function I called this variable okay call this user and assign the verify example web developer right then I call this function inside the class right I changed the value inside the second function which have access modifier public and I called this keyword the variable name which available and said that a class okay outside of the function right and I assigned a value web developer then I will call the display function then you will able to see your variable values our web developer let's check it now I change first I comment that and I call obj this said that and then in the browserify the page just a minute find the problem in just a minute okay okay okay I I using this function like this okay then I think everything is perfect okay let's check it now as you can see guys your variable values are web developer but inside the a-class outside of the function I have a fine W in the user variable web designer inside the next function I mean this is the first function this is the second function inside the second function I have called the same variable which available inside the class outside of the function and I have assigned the value web developer then I call this and this function inside this function have adjustable use your variable values are this keyword and this variable those are protected okay function and variable you can create a public function then you will access the variable and also function inside the public function then you will call the public function outside of the class I mean create an object and call the function you can also just a minute I comment that and I also comment this function okay then like called Class D and I call extends a class split eights inside this I call again function the function is a public I call function public function display and I call this and dot user and first character the small I assign the value PHP developer I call again this not my then you will able to see your variable values our PHP developer fight okay I wanted to make a object of the littlest so called rpj children new be class why I have met the object of the be class because the p class extend the a class it means the p class are able to use the a class variables and also methods are functions so I call ovg function save that hand and open a browser to the page as you can see guys your variable values are PHP development it means protected access modifier is used to inside this class outside of the class and also you can use that in the child class you can say that child class and now the important thing is I remove the protected I call function mal fun this is a default public access modifier okay default public access modifier but I can't I remove the access modifier from the variable we have seen that why because we need to assign that protected public our private access modifier before creating a variable but you will create a function without X is modified the default access modifier public okay so this is all about access modifier in the next movie I'm going to teach with you private access modifier so thank you very much for watching see you in the next lecture guys hello guys welcome back in this video I'm gonna teach with you private access modifier private means you can use the variable function inside the class you can't use the variable and function outside of the class so I will teach you how you can use private access modifier lack of variable and first I write pirate access modifier and how to use this is a private variable if you want to use that outside of the class you can't do that let me show you how do you continue and the class name obj user right I also use the question let me show you save that and then open the browser for the patch contacts is private property this is a class name this is a variable this is a private access modifier I assigned the value also said that right but I change the access modifier like public I change them like say that right okay y-you can't use the access modifier private outside of class basically this is a private you can use that inside the class if you want to use outside of the class so you need to follow on two steps the first is did assign make up function and then was a car public function set pass the one parameter inside the parentheses you can write any name in my case I used a inside this function I called this Shiva and use a variable which available inside the class and assign the AV this is a assigning function I want to display the data on the browser so I use public function you can write any name I use your chunky but also various okay then I have concatenation sign this dot use it commit that then first I need to call the obj and - greater than sign and saved data we need to pass the V you can pass numbers string value you can do that in my case I use web developer serve that but you can't see the result on the browser why because we need to use also gate function to display the data on the browser let me show you as you can see guys so I go to again we call VJ gear did it did and also we need to use the question member because this is a return function as you can see said that and refer the page your value is where developer right I assign also kosterman in the first so let's check it now desert sand is that okay bad this is not important okay this is not important so you need to make a function then pass the parameter and I used class variable to assign the value which available inside the parentheses function parentheses if you will call this function outside of the class you need to pass the value then do you want to display that variable value on the browser so you need to make a function like gate data you can write any name and also you need to use return keyword then by the text and variable which available inside that class that class variable name is the user then you need to call a question man and object of the class and last one method or function and then the data has been appeared on the process right no this is a private [Music] well you were right but I want to make a function type function so you can use this way also I comment that first I commend that and a call function private function my fun this is a my private function and say the private function I call custom and I hope I want to display this function outside of the class so we need to make a function public function write any name I use get data this is a function name inside this function I just use this dot function name said that we need to call this function outside of the class so I commend that and I have already called this function let's check it now hey everyone I hope you all are fine okay now I want to change the value of this function so we need to make a variable like I call message right then I need to make another function suited and I also passed a very like a and I call this dog message no I shall miss it because this is a function variable this is a not class variable and I call this variable locate this video then mmm said it okay and the return function I mean in the gate function I need to use this need to remove that and a call nature your function okay I want to change the value right okay okay okay I want to change so I think everything is perfect this dot my phone okay but we need to assign the value inside the outside of the class save that and okay I can't see anything else on the trouser and this variable assign in the message variable and a message unless you good no no hmm I use another method another way okay I use another way just a minute I removed also D I use I have changed function and said that and also I need to remove the mmm-hmm get it okay okay okay just a minute dysfunction call me Chi guys here is a mistake no I need to use it and also I need to use this method okay let's check it now okay I need to check it now game okay change as you can see guys I have changed the function variable values right so this save data function first I go to a bow this is a private function and this is also private variable I've explained you all about private variable but this way is a function private private function okay inside this function have one variable and assign the video hi everyone I hope you are all fine okay then I want to change this function variable value so I need to make a function with the help of public access modifier and why didn't you name of the function inside this function you need to call the same variable which available inside the private function then change the value and colloquy statement to display the return the browser then you also need to make another function like the data and inside that gave data you just need to call this dot my fun function which have a private function right so this is the a lob out access modifier private access modifier and hope we are understood as well thank you very much for watching see you in the next lecture hello guys welcome back in this video I'm gonna teach with you overriding in PHP how you can use our riding in PHP so first I will create a class I'll teach you just a minute to callosity first I will show you our riding instructor I make a constructor public function underscore underscore construct right inside this constructor I call just because statement and call then that's my parent class constructor I want to display this date on the browser so I called obj continue and class name right then you will able to see this data will appear on the browser let's check it now as you can see that's right but I want to use all writing how I can do there as you need to make another class so I make another class B and you need to use extend keywords to extend the a class then I want to our adding this constructor so I need to make same things like public function underscore underscore constructor inside this constructor I want to change the text or change the waiting for example I use welcome know I use that's my child class constructor save that then you will able to see guys this constructor data will not be on the browser but we need to make object of obj chill to new and big lastly we need to make a object of the class after creating my object then we will able to see this data will appear on the browser why you are able to see this data because this is overriding okay let's check it now as you can see guys there's my child class constructor this is a constructor overriding inside the parent class hero constructor I used same constructor inside the second our child class with the name of be Clause and said this class I had changed D text it means and the a class have a text that's my parent class constructor after extend the a class then I want to change the constructor value this is a call overriding our widen constructor all right this is a constructor all right it means the overriding means hide the first one with you our first one function data and this play the second one or update the hide the first one constructor value and display the updated value on the browser this is a call overwriting okay you can also use overriding to use in the function okay first I can bind it and I make a class function plus a I make a function function right then I use function public function my fun inside a classic Hall and the everybody I am parent class function I want to overwrite the function like my fun are I want to update the my fun function so we need to make another class experience sick loss function all right okay so I make a same function with the city with the help of public function and same day okay same name then I change that text art I did the text everybody I am a child class function it means I want to hide this function data and display the parent class I'm in child class data under thousand this is a call overriding okay so I need to make object of the class and then you will able to see I call my funded and then open the browser for the pitch everybody on any child class function okay if I command this one okay then you will able to see parent class function value hey everybody I am parent class function okay you can also use also pass the parameter okay just a minute I comment that just a minute I comment that I make a function function my phone and I call it call it V V is concatenation sign and variable name concatenation sign and how you are concatenation sign and second variable right then I want to update this function so I go to the next one class like B and a call function I need to use also public key replace public function my fan then I want to update the function I want to pass three parameters so I pass a b c is concatenation sign in a variable concatenation sign concatenation science second variable concatenation sign you will see variable radio is concatenation science civil right terminator sign then we need to pass the three parameter after calling the function okay I use I use one comma Calma Calma and I use program save that and then open the browser to the page you are a believe is one your B value is programmer your C value is a blower okay I command that I comment that and I call also comment that I make object of the a class and I call out PJ my fun then we need to pass through parameter this is a parent class function if you want to use that so I use programmer save that and after the pitch right you're a value is program up your p-value is a developer okay if you want to use them both of them so I comment that and I just be attacked first I check itself that and then open the browser for the page first you are able to see see video plugin okay then we are able to see to display the parent class function value you are a very list programmer your p-values developer and this function is a child class function okay I'll use BR take just a minute I said that okay this is a your parent class data after update this data to convert this data into three parameters and the three parameters is a a b c and those are values of the ABC variables this is a call over ideal function overriding it means inside the tenant class have a function with them with two parameters we want to update this function so you can use i mean you can make a class and extend the parent class the current class is a and i want to change the parameters i can do that i want to change the text i can do that you can do that after our extreme the parent class right so this is the call overriding function and constructor our ID so i hope your understood as well thank you very much for watching see you in the next picture hello guys welcome back in this video I'm gonna teach with you abstract analysis and I abstract method abstract means incomplete you can create a abstract class that's been incomplete give us we want to create a abstract method it means this is the call and complete method I will show you first I have created that's back to us so first thing you need to buy the abstract keyword canal's class name I use my class this is incomplete class I can't make the object of this class one because this is an incomplete kill us okay inside this class I will make that complete method write function public function my course okay I want to display this function date on the browser first remember that I can't make object of the abstract class let's check it now I use object the extra class they call OPG children you my class and I want to use the function so I just my phone said that benefit it as you can see guys heart instead yet registered a class my class why because this is an incomplete class you can't make the object of the incomplete class right do you want to use the incomplete class methods so you need to make another class I use class complete then use extends cleaver to inhale D then after creating object I mean extend the abstract class then you will create object of the complete class then you will use my function method which available inside the abstract class ok so I make object of complete class complete I use obj my father said that I'm dead welcome to my boss right now another thing this is a complete myth I can make incomplete method and say the abstract class and complete in let that our function you can say that function so I make incomplete abstract class I mean function okay so I use abstract function then company this is a my incomplete function but you need to write up the top so this is an incomplete function do you want to complete this function so you need to extend the class like this you need to make a class like complete and extend that class like abstract class then inside the complete class you will complete the incomplete method this is the incomplete method way I want to complete this method so we need to make a class complete extend the abstract class then you need to write the same like function same function name then complete this is an incomplete function name I have used same function name inside the complete chaos then I use complete method right then I called the game for Tidus BR I call obj complete so in what the name of the function then complete complete okay then you will able to see this data will appear in the browser let's check it now I'm a completed method as you can see place so this is a call incomplete abstract class and say the abstract class you can create a complete and also incomplete method if you want to use extra class functions are you will get I mean you can update the incomplete class to complete you need to make another class like complete and extend the abstract class inside that complete class you can call the extra class method and also you can complete the incomplete method which available inside the abstract class okay so this is all about abstract class I hope you understood as well thank you very much for watching see you in the next lecture guys hello guys welcome back in this video I'm gonna teach PDU interface and FS barking similar like abstract class an abstract class we have made the function like incomplete and complete an interface you can't make the complete methods you can make only incomplete methods then you will implement the class then you will access the incomplete method right let's check it not my user interface so I want to make interface so you need to write interface then interface name files my write the name of interface my demo inside the interface I can't make the complete method I will show you I arrived at the cout statement okay alright camula this is an error as you can see interface function my demo can't contain audio this is a car body so we need to make a incomplete function okay and we don't need to use abstract class I'm in abstract key were to make an incomplete function the default interface haver abstract keyword inside the function let's check it now I use first said that this is an incomplete one method okay then I put the browser under for the page I can't see anything else okay don't worry I want to use this function so I need to make a class data you can write any name and I need to use implements keyword and the interface name okay first step there and then let's check it again as you can see guys class data contains one abstract method okay this is the abstract method in the method have a default abstract keyword so I want to use this function inside the data kill us so we need to use new public function same function name then I use a Christian man everyone right here okay serve that and then I need to make object of the data class you cannot follow Vijay more fun said that let's check it now hey everyone available on the browser ok this is a demo my demo interface okay you can also make multiple in interface and also you can add multiple interfaces inside the single class let's check it now used interface my demo one second one I use public function my I make another function I mean interface my demo true celebrated and I like a public function my fun too I met three interfaces okay then I want to use those interfaces inside the data class so after the connect each I'm in single interface then I want to connect another interface with data class so you need to write the comma and second one interface comma third one interface then you will use this second interface method and also third one method inside the data class let's check it now I shall my fun one is this sector that's my passion I just that's my function one public function - - those function available on the each interface I have used only one calais and implements multiple remember them multiple interfaces and single class then I am able to access the multiple interfaces data inside a single class okay so I use the core that's my function to say that and go to blow obj my final man Oh BJ my fun tool said that also I use B attic that's ticket now my that's my function that's my function one blood I seemed error my phone to my fun there is a 42 there is a mistake I need to use greater than science save that and let's see now again my function there's my function there's my function 1 that's my function - it means I am able to access multiple interface inside the single class using implements keyword ok this is a multiple interface so guys I hope you are understood as well thank you very much for watching see in the next structure
Info
Channel: OnlineITtuts Tutorials
Views: 5,917
Rating: undefined out of 5
Keywords: Object Oriented Programming in Php, oop in php for beginners, oop in php tutorial, oop concepts in php, OnlineITtuts Tutorials
Id: Rg8bsXP-M_Y
Channel Id: undefined
Length: 132min 42sec (7962 seconds)
Published: Sat Nov 03 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.