reference : 인프런 이재승님 강의
if you inherit other class , you can use the variables and methods in the parent class
when creating a constructor in a child class, you must call super
if you not called super in a child class , an error occurs.
if the sayHello()
method is called after the Programmer instance
is created, the sayHello() method in the child class is called.
you only need to call it if you want
public
: as it is exposed externally, it is also exposed on the inheriting side. protected
: it is not exposed externally , but it is exposed on the inheriting side.private
: it is not exposed externally , it is also not exposed on the inheriting side.by default, public is used
if you use private
access restrictor , occur an error when you object use
if you use protected
occur an error when you create instance object and call protected variable
but you can use protected
where it is inherited.
if you declare protected
to constructor , you can't create instance object
so Person class
can't make object
readonly
is literally read-only.
a readonly variable can't change it's value.
you can define a static method using the keyword static
a static member variable is a fixed value independent of each object.
be used to ing : ~ 하는데 익숙하다.
be used to : ~ 하곤했다.
be used : 사용되다 , 쓰이다.
an abstract class cannot be made into an object.
when an abstract class is used, the inheriting class must declare the variables and methods in the parent class.