dcsimg
calling a protected method from the base class in an inherited class.
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Manas_Behera
Posted On:   Friday, September 7, 2001 01:38 AM

How can i call a method which is declered as protected in a base class from a inherited class ??
kindly answer ..

Manas

Re: calling a protected method from the base class in an inherited class.

Posted By:   Rashmi_G  
Posted On:   Friday, September 7, 2001 03:50 AM

This is very trivial Manas,
I have pasted the code below . try it out.


class iBase{
protected void method(){
System.out.println("Base class method");
}
}

class In1 extends iBase{
public static void main(String args[]){
In1 o = new In1();
o.method(); //Derived class Ref

iBase b = new iBase();
b.method();
}
}


Hope this helps.:)
Rashmi
About | Sitemap | Contact