Core: Visibility Modifiers
At this point we've been talking about what's inherited?
We've used the terms private and public and those visibility modifiers impact what gets inherited from one class to another.
What we're gonna do now is spend a little more time looking
at the different visibility modifiers and how they impact us.
Particularly in relation to inheritance.
By the end of this video, you should be able to use the appropriate visibility
modifiers when you're writing your class.
in the title, let me explain each word Visibility Modifiers
Visibility means the acess to domains
Modifiers are these four words in this context, they are public,protected,package,private
there are two domains:
package
class
there are three ways to control domain of variable acess:
they are
public : no control to any domain
protected : within the same package and sub class
packaged : within the same package
private : within the same class
Core: Object Creation in Java
what we're gonna do next is look at object construction in Java.
Now, you've already reconstructed before, so you might say,
well, wait a second why are we revisiting this?
Well, the reason we're revisiting this is because now we know inheritance,
we now know some more details about how objects actually get constructed.
look at how Java actually constructs or initializes its objects really from the inside out. And a second piece to this is once given that space, pass a reference to that space to the constructor for initialization.
In fact constructors really should be called Initializers, and you'll see in other programming languages that they're actually called init.
So really what the student constructor does is just initialize the variables associated with student.
And the way that's gonna do this is essentially from the inside out.
you create the space for the object
then you pass that space to the student constructor