「OOPS インタビューの質問と回答」

OOPSインタビューの質問と回答へようこそ。Java、C++、Pythonなど、多くのオブジェクト指向プログラミング言語があります。これらのプログラミング言語の面接に臨むなら、OOPSの概念を明確に理解することが非常に重要です。そのため、トップのOOPSインタビューの質問を共有し、詳細な回答を提供したいと思いました。

「OOPS インタビューの質問」

    マルチプル継承では、1つのクラスが複数の親クラスから状態や動作を継承することができます。
A child class inheriting states and behaviors from multiple parent classes is known as multiple inheritance.
    継承におけるダイヤモンド問題とは何ですか? (Keishō ni okeru daiyamondo mondai to wa nan desu ka?)
In case of multiple inheritance, suppose class A has two subclasses B and C, and a class D has two super classes B and C.If a method present in A is overridden by both B and C but not by D then from which class D will inherit that method B or C? This problem is known as diamond problem.
    なぜJavaは多重継承をサポートしていないのですか?(Naze Java wa taju keishō o sapōto shiteinai nodesu ka?)
Java was designed to be a simple language and multiple inheritance introduces complexities like diamond problem. Inheriting states or behaviors from two different type of classes is a case which in reality very rare and it can be achieved easily through an object association.
    静的バインディングと動的バインディングとは何ですか?
Static or early binding is resolved at compile time. Method overloading is an example of static binding. Dynamic or late or virtual binding is resolved at run time. Method overriding is an example of dynamic binding.
    「IS-A」と「HAS-A」の関係の意味は何ですか?
"IS-A" relationship implies inheritance. A sub class object is said to have "IS-A" relationship with the super class or interface. If class A extends B then A "IS-A" B. It is transitive, that is, if class A extends B and class B extends C then A "IS-A" C. The "instanceof" operator in java determines the "IS-A" relationship. When a class A has a member reference variable of type B then A "HAS-A" B. It is also known as Aggregation.
    1. 協会とは何ですか? (Kyōkai to wa nan desu ka?)

or

協会とはどういうものですか? (Kyōkai to wa dō iu mono desu ka?)

Association is a relationship between two objects with multiplicity.
    集約とは何ですか? (Shūyaku to wa nan desu ka?)
Aggregation is also known as "HAS-A" relationship. When class Car has a member reference variable of type Wheel then the relationship between the classes Car and Wheel is known as Aggregation. Aggregation can be understood as "whole to its parts" relationship. Car is the whole and Wheel is part. Wheel can exist without the Car. Aggregation is a weak association.
    作文とは何ですか? (Sakubun to wa nan desu ka?)
Composition is a special form of Aggregation where the part cannot exist without the whole. Composition is a strong Association. Composition relationship is represented like aggregation with one difference that the diamond shape is filled.
    依存とは何ですか? (Izon to wa nanidesu ka?)
When one class depends on another because it uses that at some point in time then this relationship is known as Dependency. One class depends on another if the independent class is a parameter variable or local variable of a method of the dependent class. A Dependency is drawn as a dotted line from the dependent class to the independent class with an open arrowhead pointing to the independent class.
    連携と依存の違いは何ですか? (Renneki to izon no chigai wa nan desu ka?)
The main difference between Association and Dependency is in case of Association one class has an attribute or member variable of the other class type but in case of Dependency a method takes an argument of the other class type or a method has a local variable of the other class type.
    クラスとは何ですか?
A class is the specification or template of an object.
    オブジェクトとは何ですか?
Object is instance of class.
コメントを残す 0

Your email address will not be published. Required fields are marked *