dcsimg
declare method as abstract static
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Aleksey_Skorokhodov
Posted On:   Thursday, August 8, 2002 08:52 PM

it's impossible to declare method as abstract static.
so, how to write a code like this?

			
public abstract class Factory {

public static abstract String get(...);

public static int save(...) {
...
}
}

public class MyFactory extends Factory {
public static String get(...) {
....
}

}

Re: declare method as abstract static

Posted By:   jyothi_y  
Posted On:   Thursday, August 8, 2002 10:05 PM

Hi

you can not declare a method as abstract static,to have a static method in your abstract class write like this.

public abstract class Factory {

public static String get(...) {
return null;
}

public static int save(...) {
...
}
}

Now you can over ride this method in your MyFactory class.
Hope this will help you.

Regards---Jyothi.

Re: declare method as abstract static

Posted By:   Roger_Hand  
Posted On:   Thursday, August 8, 2002 08:57 PM

A cheap workaround if you really want the method to be static:
public abstract class Factory {

public abstract String getXXX(int param);

public static int save(...) {
...
}
}

public class MyFactory extends Factory {
public String getXXX(int param) {
return getXXXStatic(param);
}
public static String getXXXStatic(int param) {
....
}

}

About | Sitemap | Contact