[정보처리기사/소프트웨어개발환경] Procedural Programing Language vs Object Oriented Programing Language
Procedure programming
Procedural Pgorgamming can be defined as a programming model which is derived from structured programming, based upon the concept of calling procedure.
Languages used in procedure programming
- ALGOL
- C
- FORTRAN
Object oriented programming
Object oriented programming can be defined as a programming model, which is based upon the concept of object.
Languages used in object oriented programming
- Java, C++, C#, Python
- PHP, JavaScript, Ruby, Perl
OOP's Concepts
Concepts | Description |
Abstract (추상화) | Data abstruction is the process of hiding certain details, and showing only essential information to the user. |
Inheritance (상속) | Allows you to reuse code by referencing the behaviors and data are of an object. In other words, a class that inherits from another class shares all the attributes and methods of the references class. |
Multiple inheritance (다중상속) | You can also create a class that inherits for more than one class. Multiple inheritance allows us to build up a class by inheriting from many classes. |
Polymorphism (다형성) |
Polymorphism is the ability of an object to take on many forms. EX) Overriding, Overloading |
Dynamic binding (동적 바인딩) |
The process of linking procedure call to a specific sequence of code(method) at rum-time. |
Access Modifier (접근 제어자) |
Access Modifiers help to restrict the scope of a class, constructor, variable, method, or data remember. |
Types of Access Modifiers in Java
There are four types of access modifiers available in Java:
1. Default - No keyword required
2. Private
3. Protected
4. Public
Default
When no access modifier is specified for a class, method, or data member - It is said to be having the default access modifier by default.
The data members, classes, or methods that are not declared using any access modifiers i.e having default access modifiers are accessible only within the same package.
Private Access Modifier
The private access modifier is specified using the keyword private. The method or data members declared is private or accessible only within the class in which they are declared.
① Any other class of the same package will not be able to access these members.
② Top-level classes or interfaces can not be declared as private because
- private means "only visible within the enclosing class."
- protected meas "only visible within the enclosing class and any subclasses."
Protected Access Modifier
The protected access modifier is specified using the keyword protected.
The method or data members declared as a protected are accessible within the same package or subclasses in different packages.
Public Access modifier
The public access modifier is specified using the keyword public.
- The public access modifier has the widest scope among all other access modifiers.
- Classes, methods, or data members that are declared as public are accessible from everywhere in the program. There is no restriction on the scope of public data members.
Reference 🙇🏻♀️
https://www.geeksforgeeks.org/access-modifiers-java/