
Intro to Object Oriented Programming - Crash Course
video description
You drive to an ATM to withdraw some money. Without -encapsulation-, you would will simply open the ATM and grab all the money stored. With -encapsulation-, the ATM will restrict access to the money. So the -withdraw- function may:
1) Authenticate you to see if you have rights to ANY amount of money, or to the given account
2) Limit the withdrawal amount based on how much money you have in a bank account or line of credit
3) Further limit the withdrawal amount based on daily limits (you have enough money, but you can only get so much money out in a given day)
4) Assess any fees for the transaction
Likewise, you never want to give any clients direct access to data.
Date: 2022-03-14
Related videos
Comments and reviews: 9
Vonaan
This is the best explanation I've been able to find. I was creating my own first OOP application and was struggling to see the difference between a class and an object. This explanation via chess makes it so obvious that I wonder why I didn't get it in the first place. It's al about the chess example and the way you explain it. You have great presentation and tutor skills. Now I just need to start my application from scratch again. Please could you also explain the several UML diagrams based on this chess example? That would be a great way to show everyone how you can design your application with OOP in mind before even starting to code. It would have prevented me from making a lot of beginners and obvious mistakes.
reply
This is the best explanation I've been able to find. I was creating my own first OOP application and was struggling to see the difference between a class and an object. This explanation via chess makes it so obvious that I wonder why I didn't get it in the first place. It's al about the chess example and the way you explain it. You have great presentation and tutor skills. Now I just need to start my application from scratch again. Please could you also explain the several UML diagrams based on this chess example? That would be a great way to show everyone how you can design your application with OOP in mind before even starting to code. It would have prevented me from making a lot of beginners and obvious mistakes.
reply
Atul
This really helped me a lot
Thanks :)
1) Encapsulation - Data Hiding. Use setters and getters to set and get data respectively.
2) Abstraction - Defining a simple model of a complex thing so that our fellow programmers don't need to inspect the inner complexities/working of our class
3) Inheritance - The properties and methods of the super class can be used in the subclass except private classes'. Public => Can be accessed from anywhere; Private => Can be accessed in that class only; Protected => Can be accessed in that class and it's subclass
4) Polymorphism => The methods can take many forms depending on the number of parameters/data type of parameters/order of parameters
reply
This really helped me a lot
Thanks :)
1) Encapsulation - Data Hiding. Use setters and getters to set and get data respectively.
2) Abstraction - Defining a simple model of a complex thing so that our fellow programmers don't need to inspect the inner complexities/working of our class
3) Inheritance - The properties and methods of the super class can be used in the subclass except private classes'. Public => Can be accessed from anywhere; Private => Can be accessed in that class only; Protected => Can be accessed in that class and it's subclass
4) Polymorphism => The methods can take many forms depending on the number of parameters/data type of parameters/order of parameters
reply
Nicola
Resume:
1) Encapsulation ----> Getters and setters
2) Abstraction --> We care about Interface. Not the implementation behind the hood.
3) Inheritance --> Extending classes... Access modifiers: public, private, modifier
4) Polymorphism --> Interface / Implements in Java ... Same methods' name, but different implementations of methods.
reply
Resume:
1) Encapsulation ----> Getters and setters
2) Abstraction --> We care about Interface. Not the implementation behind the hood.
3) Inheritance --> Extending classes... Access modifiers: public, private, modifier
4) Polymorphism --> Interface / Implements in Java ... Same methods' name, but different implementations of methods.
reply
MyTech
The real question now, does oop solve any real problem outside of a game like structure? I have never seen an example that wasn't completely game centric. Yes I know oop doesn't break Turing completeness and thus can be used for any program. I'm asking if oop is a good fit for problems outside of games.
reply
The real question now, does oop solve any real problem outside of a game like structure? I have never seen an example that wasn't completely game centric. Yes I know oop doesn't break Turing completeness and thus can be used for any program. I'm asking if oop is a good fit for problems outside of games.
reply
thecaveofthedead
Very useful. Criticism: sometimes you're referring to this object refers to this object and it became completely unclear in which direction interactions were happening.
reply
Very useful. Criticism: sometimes you're referring to this object refers to this object and it became completely unclear in which direction interactions were happening.
reply
flyagaricfly
Thanks, Freecodecamp. You're my favorite guide in programming. This narrator is really nice to listen to, and the formal style makes the tutorial somewhat more engaging :)
reply
Thanks, Freecodecamp. You're my favorite guide in programming. This narrator is really nice to listen to, and the formal style makes the tutorial somewhat more engaging :)
reply
siva
Sir,I have a doubt in oop in JavaScript.when can implement anything in JavaScript without oop also.Then what is the use of oop in JavaScript?When do We use oop in JavaScript?
reply
Sir,I have a doubt in oop in JavaScript.when can implement anything in JavaScript without oop also.Then what is the use of oop in JavaScript?When do We use oop in JavaScript?
reply
Michael
Excellent! Clear and concise. Also fluent English, instead of a bastardized version you have to try to figure out what they say more than what they're talking about.
reply
Excellent! Clear and concise. Also fluent English, instead of a bastardized version you have to try to figure out what they say more than what they're talking about.
reply
Cyberpunk
History. One must fast, that is, not fall asleep, because something happened sometimes when collective memory erased. System remained. Programming not for kids.
reply
History. One must fast, that is, not fall asleep, because something happened sometimes when collective memory erased. System remained. Programming not for kids.
reply
Add a review, comment
Other channel videos















