Click here to Skip to main content
15,911,531 members
Home / Discussions / Web Development
   

Web Development

 
AnswerRe: JS menu not running on homepage Pin
Fred_Smith2-Oct-07 14:13
Fred_Smith2-Oct-07 14:13 
GeneralRe: JS menu not running on homepage Pin
Tylee234-Oct-07 6:33
Tylee234-Oct-07 6:33 
GeneralRe: JS menu not running on homepage Pin
Fred_Smith4-Oct-07 6:57
Fred_Smith4-Oct-07 6:57 
Questionlink rel Questions Pin
Brendan Vogt2-Oct-07 5:10
Brendan Vogt2-Oct-07 5:10 
AnswerRe: link rel Questions Pin
Fred_Smith2-Oct-07 6:36
Fred_Smith2-Oct-07 6:36 
Questionmixing the javascript code to .net Pin
vanhawk1-Oct-07 22:08
vanhawk1-Oct-07 22:08 
AnswerRe: mixing the javascript code to .net Pin
kubben2-Oct-07 2:57
kubben2-Oct-07 2:57 
QuestionHelp me impliment this class structure Pin
eggie51-Oct-07 13:04
eggie51-Oct-07 13:04 
I have a class Category, that derives from the ServiceResource class.

//Base class for all resources
//Lots of these properties must be overridden by the derived class
//Starting to think it makes more sense for this to be an interface instead...
public class ServiceResource
{

    public string endpoint_url; //this MUST be over ridden by the derived class


    //this takes the object and saves it via API call
    public ServiceResponse Save()
    {
        string post_params = BuildParameters(); //this should call BuildParameters in the derived class

        ServiceRequest request = new ServiceRequest();

        ServiceResponse resp = request.Send("POST", this.endpoint_url, post_params);

        return resp;
    }

    public string BuildParameters()
    {
        throw new Exception("You must set this in the derived class");
        //this MUST overridded by descendent class so this class can make the requests to the API endpoint
    }
}


And the Category class:

public class Category : ServiceResource
       {
           private int id;
           private string name;

           public string BuildParameters()
           {

               return "I am overriding base.BuildParameters()";
           }

           //Override base.endpoint_url
           public string endpoint_url = "/categories";

           public int Id
           {
               get { return id; }
               set { id = value; }
           }

           public string Name
           {
               get { return name; }
               set { name = value; }
           }
       }


Now I would like to be able to use the Category class like this:
Category c = new Category();
c.Name="new category";
c.Save();


Now when Save is called, it will call the method BuildParameters. However, I want it to call BuildParameters in the derived class and not the base class, same with endpoint_url. At this point, base.BuildParameters is called instead.

How can I do this.









/\ |_ E X E GG

AnswerRe: Help me impliment this class structure Pin
kubben1-Oct-07 16:17
kubben1-Oct-07 16:17 
AnswerRe: Help me impliment this class structure Pin
Paddy Boyd2-Oct-07 6:03
Paddy Boyd2-Oct-07 6:03 
QuestionNeed help: How to deploy SharePoint web application to another server? Pin
bin_bin11-Oct-07 12:59
bin_bin11-Oct-07 12:59 
QuestionAJAX PopupControlExtender Dynamic Update Pin
3nbar, A7mad A1-Oct-07 4:48
3nbar, A7mad A1-Oct-07 4:48 
AnswerRe: AJAX PopupControlExtender Dynamic Update Pin
L Viljoen3-Oct-07 0:00
professionalL Viljoen3-Oct-07 0:00 
Questionerror "enable to attach. The stub received bad data Pin
EISMANSI1-Oct-07 2:14
EISMANSI1-Oct-07 2:14 
QuestionRetreive querystring on httprequest Pin
Dagoessem1-Oct-07 0:15
Dagoessem1-Oct-07 0:15 
AnswerRe: Retreive querystring on httprequest Pin
Fred_Smith1-Oct-07 1:20
Fred_Smith1-Oct-07 1:20 
Questionjavascript:window.close() Pin
vanhawk30-Sep-07 21:19
vanhawk30-Sep-07 21:19 
AnswerRe: javascript:window.close() Pin
Fred_Smith30-Sep-07 22:22
Fred_Smith30-Sep-07 22:22 
GeneralRe: javascript:window.close() Pin
vanhawk30-Sep-07 23:11
vanhawk30-Sep-07 23:11 
GeneralRe: javascript:window.close() Pin
Fred_Smith30-Sep-07 23:22
Fred_Smith30-Sep-07 23:22 
GeneralRe: javascript:window.close() Pin
vanhawk30-Sep-07 23:47
vanhawk30-Sep-07 23:47 
AnswerRe: javascript:window.close() Pin
Guffa1-Oct-07 1:38
Guffa1-Oct-07 1:38 
QuestionSession Variables Pin
sweet_piky30-Sep-07 20:18
sweet_piky30-Sep-07 20:18 
AnswerRe: Session Variables Pin
Fred_Smith30-Sep-07 22:14
Fred_Smith30-Sep-07 22:14 
Questionmail problem on http://www.vwdhosting.net Pin
DreamerPhantom30-Sep-07 9:00
DreamerPhantom30-Sep-07 9:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.