if we perform it directly java compiler wilk give compile time error
Anonymous Quiz
37%
upcasting
63%
Downcasting
class One {
// طريقة m1
public void m1() {
System.out.println("m1 method in class One");
}
}
// الفئة الفرعية Two التي تمتد من One
class Two extends One {
// طريقة m2
public void m2() {
System.out.println("m2 method in class Two");
}
}
// الفئة Test تحتوي على دالة main
public class Test {
public static void main(String[] args){
One N=new One ();
Two t = (Tow) N ;
//t.m1();
t.m2();
}
}
تجمع شيتات واسئلة oop
الupcasting توصل في دوال الاب فقط الا اذا كان فيه override والا هيصير كومبايلر تايم ايرور
وDowncasting توصل في دوال كلهن الاب والابن
❤3
method is overriden not the datamembers so runtime polymorphism cannot be achieved by data members
Anonymous Quiz
42%
✅
58%
✅✅
we use it when we need to develop a code that deals with only the parent class
Anonymous Quiz
77%
upcasting
23%
Downcasting
Forwarded from لَيطمِئن قــلَبّــكَ (𝑀𝒶𝓌𝒶𝒹𝒶 𝒜𝓁𝒶𝓂𝒶𝓇𝓎)
"اللهم يا جامع الناس ليومٍ لا ريب فيه، اجمع لنا بين النجاح والتوفيق في امتحاناتنا. اللهم يسر لنا الصعاب، ووفقنا إلى ما تحب وترضى، وارزقنا فهمًا وذكاءً ونورًا في دراستنا. آمين."
❤22
Forwarded from S.O.P("قناة مناهج كلية تقنية المعلومات");
.... and .......are the primary mechanisms for passing information into and out of an object.
Anonymous Quiz
31%
Parameters, Variables
14%
Methods, compiler
56%
Methods, parameters.
❤1
Forwarded from S.O.P("قناة مناهج كلية تقنية المعلومات");
The new operator is not required to explicitly create the object that is referenced
Anonymous Quiz
40%
True
60%
False
Forwarded from S.O.P("قناة مناهج كلية تقنية المعلومات");
Each object (instance) of the class has a separate instance of the variable in memory.
Anonymous Quiz
78%
True
22%
False
Forwarded from S.O.P("قناة مناهج كلية تقنية المعلومات");
When a method terminates, the values of its local variables will still be available.
Anonymous Quiz
38%
True
62%
False
👍1