--Originally published at diegotc2016
Watching this video tought me about several things first, there are 2 types of programs:
- Static: Java, C# and C++
I also learned what is a class in OOP, a class is a definiton of type of data which is defined by its members:
- Field: Data member
- Method: Function sociated with a class
In this video I also found an alternative meaning for object/instance which is piece of data.
Principles for OOP
The person that was speaking during this video told different principles for OOP
- Class Members
Encapsulation can be defined by the fields of an object and class should only be read or written by the method of that class.
The mistakes you can make avoiding this principle is to have a spaghetti code which is a code that is very difficult to read or to understand.
Types of class
- Public: can be manipulated or visible anywhere (inside or outside the class)
- Private: only can be manipulated by the methods of its own class
A type of class may include all members from another type. For example: Lets say we have Sebastian Vollmer, Offensive Line, Patriots. Sebastian Vollmer is inherts from the offensiveline and the offensive line inherts from the Patriots its an aoutomatic inheritance.
For using inheritance first you have to ask…It has a relationship or it is a relationship. For example: Sebastian vollmer is a member of the offensive line of the Patriots.
It is ok to have multiple inheritance but you have to follow certain rules in order to do it, what it is not legal is to use circular inheritance
It means to redifine an inherted metod
Member of a class itself not its instances, for example: class.field or class.method(args)
A method which is run when someone instanciates a class
A set of methods which are related one another.
A class which cannot be intantiated, it works as an ancestor of other classes
OOP without classes: producing child instances from parent instances
Common ways of organizing patterns to solve different types of problems using programming.
Here’s the video: