AN EXAMPLE FOR DYNAMIC METHOD DISPATCH
#1

Code:
class A
{
void display()
{
               System.out.println("Inside A");
       }
}
class B extends A
{
        void display()
        {
               System.out.println("Inside B");
        }
}
class C extends B
{
       void display()
      {
             System.out.println("Inside C");
      }
}
class OverrideDemo
{
       public static void main(String arg[])
       {
             A a=new A();
            B b=new B();
            C c=new C();
            A r;
            r=a;
            r.display();
            r=b;
            r.display();
            r=c;
            r.display();
       }
}


OUTPUT
E:\ 5BCA-B\lijo\java >java OverrideDemo
Inside A
Inside B
Inside C







Reply

Important Note..!

If you are not satisfied with above reply ,..Please

ASK HERE

So that we will collect data for you and will made reply to the request....OR try below "QUICK REPLY" box to add a reply to this page
Popular Searches: fuzzy medical example, an example of a vote of thanking of a seminar, dynamic method dispatch example in java, example jbits, example of speech on seminar, example crime scene report, robocode example,

[-]
Quick Reply
Message
Type your reply to this message here.

Image Verification
Please enter the text contained within the image into the text box below it. This process is used to prevent automated spam bots.
Image Verification
(case insensitive)

Possibly Related Threads...
Thread Author Replies Views Last Post
  Program to implement the data link layer framing method character stuffing smart paper boy 0 7,954 10-08-2011, 11:41 AM
Last Post: smart paper boy
  Program to implement the data link layer framing method bit stuffing smart paper boy 0 2,896 10-08-2011, 11:41 AM
Last Post: smart paper boy

Forum Jump: