3
Reply

where to declare webmethod for abstract class .. ??

putchalasudhakar

putchalasudhakar

Nov 2 2003 6:01 AM
2.1k
I have a class 'Prod' which is abstract because It has a function printsome() which is my abstract method ( this in turn is what my webservice is ) I have 3 classes P1, P2, P3 which extend 'Prod'. and each define their own printsome() like P1's printsome displays "this is first" P2's .... "second one " P3's function displays "know its third" My problem is WHERE TO WRITE THE Webmethod... i mean do i startwith and say each of P1,2,3 are my webservices .. ?? 1) If this is the case, if i declare P1 as webservice, then we have like public class P1:System.Web.Services.WebService ( And also we need to extend class 'prod' ... ie., P1:prod ) ... and this becomes multiple inheritance... and cannot be done .. 2) If P1,2,3 are not my webservices, then i have to declare 'prod' as my Webservice so i have to put in my 'prod' class [WebMethod] abstract public void printsome() .. and as we know already 'prod' is an abstract class and then write the P1, P2, P3 extending 'prod' and overriding the function in their own way Now when we invoke at some other application this webservice we need to add the webreference to the webservice and so now we HAVE to create an instance of 'prod' - BUT THIS CANNOT be done since it is an abstract class Please get me out of this problem ... how do i access the printsome() of each P1,P2,P3 Thanks in advance Skar

Answers (3)