Difference between in intializing the Object of the class
-
class A { public virtual void get() { Console.WriteLine("Hello"); } } class B:A { public override void get() { Console.WriteLine("Fine"); } } Ist Method A e = new B(); e.get(); IInd Method B e = new B(); e.get(); Difference between in Ist Method and IInd Method of intializing the object of the the Class A
-
class A { public virtual void get() { Console.WriteLine("Hello"); } } class B:A { public override void get() { Console.WriteLine("Fine"); } } Ist Method A e = new B(); e.get(); IInd Method B e = new B(); e.get(); Difference between in Ist Method and IInd Method of intializing the object of the the Class A
-
class A { public virtual void get() { Console.WriteLine("Hello"); } } class B:A { public override void get() { Console.WriteLine("Fine"); } } Ist Method A e = new B(); e.get(); IInd Method B e = new B(); e.get(); Difference between in Ist Method and IInd Method of intializing the object of the the Class A
-
Difference between in Ist Method and IInd Method Ist Method returns. "Hello" IIst Method returns. "Fine"
spaps
-
class A { public virtual void get() { Console.WriteLine("Hello"); } } class B:A { public override void get() { Console.WriteLine("Fine"); } } Ist Method A e = new B(); e.get(); IInd Method B e = new B(); e.get(); Difference between in Ist Method and IInd Method of intializing the object of the the Class A
You'll get the same output in both cases because, even though you are using class A in the 1st method, you are instantiating an instance of class B (because B inherits from A). What you can't do here, is access methods of B that aren't in A.
Deja View - the feeling that you've seen this post before.
-
Difference between in Ist Method and IInd Method Ist Method returns. "Hello" IIst Method returns. "Fine"
spaps
Nope !!!! The same output = "Fine"
-
Nope !!!! The same output = "Fine"
-
if you do like this: A e = new A(); e.get(); B c = new B(); c.get(); you will have Hello and Fine too..
spaps
yes it's correct but if we have A e = new B(); //Upcasting e.get(); we will have "Fine"
-
yes it's correct but if we have A e = new B(); //Upcasting e.get(); we will have "Fine"
-
class A { public virtual void get() { Console.WriteLine("Hello"); } } class B:A { public override void get() { Console.WriteLine("Fine"); } } Ist Method A e = new B(); e.get(); IInd Method B e = new B(); e.get(); Difference between in Ist Method and IInd Method of intializing the object of the the Class A
.NET- India wrote:
Ist Method A e = new B(); e.get(); IInd Method B e = new B(); e.get(); Difference between in Ist Method and IInd Method of intializing the object of the the Class A
The question can not be answered, as it's incorrect. Neither of the two methods creates an instance of the A class.
Despite everything, the person most likely to be fooling you next is yourself.
-
class A { public virtual void get() { Console.WriteLine("Hello"); } } class B:A { public override void get() { Console.WriteLine("Fine"); } } Ist Method A e = new B(); e.get(); IInd Method B e = new B(); e.get(); Difference between in Ist Method and IInd Method of intializing the object of the the Class A
-
This idiot cannot figure out how to use Google to answer his homework questions and likes to ask the same question again.
Blog link to be reinstated at a later date.
This idiot knws very well how to use google at it's best. But i think u've a lot of free time to waste writing such a stupid or worthless answer ??????????????????????????????. If you think this is very easy question why dont u explain the solution to the probs i'm facing and for kind very information i got a solution myself. But u r the genios or the champ of champions so explain the main diff ?????????????????????????? waiting for ur reply
-
This idiot knws very well how to use google at it's best. But i think u've a lot of free time to waste writing such a stupid or worthless answer ??????????????????????????????. If you think this is very easy question why dont u explain the solution to the probs i'm facing and for kind very information i got a solution myself. But u r the genios or the champ of champions so explain the main diff ?????????????????????????? waiting for ur reply