Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6755673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:25:52+00:00 2026-05-26T13:25:52+00:00

note: for those SO fellow developers MS Ajax javascript library emulates classes, interface, enums

  • 0

note: for those SO fellow developers MS Ajax javascript library emulates classes, interface, enums and other OO features but the language does not support it. So don’t start bragging there isn’t a class in javascript.

Interface Implementation

/// <reference path="MicrosoftAjax.debug.js" />

Type.registerNamespace("Validators");

Validators.IValidate = function () {
    throw Error.notImplemented("Interface IValidate must be implemented before invoke.");
};

Validators.IValidate.prototype = {
    ErrorMessage: "",
    IsValid: false,
    Validate: function () {
        throw Error.notImplemented("Class must provide a implementation for the method");
    }
};
Validators.IValidate.registerInterface("Validators.IValidate");

Explanation:

Why am i explaining interface which doesn’t relate to the question? i will explain as it goes. The above code will create a Interface IValidate that mimics IValidator from the framework. The work of those Error.notImplemented code is as below

  • Does not allow others to do this new Validators.IValidate() (i.e) no instance
  • When a class implements the Interface, Validate() method will throw a error when not implemented

So now you must have understood how the emulation is performed. Similarly i created a class (actually i wanted a abstract class that’s why i am here), named BaseValidator like this

Validators.BaseValidator = function () {
    throw Error.invalidOperation("Base validator is a abstract class. Inherit the class to work with it");
};

Validators.BaseValidator.prototype = {
    ValidationProperty: function (propertyName) {
    },
    BackColor: function (hexCode) {
    },
    ControlToValidate: function (id) {
    },
    CssClass: function (css) {
    },
    Display: function (mode) {
    },
    Focus: function () {
    }
};

Validators.BaseValidator.registerClass("Validators.BaseValidator", null, Validators.IValidate);

at the last line you can notice that it implements Interface (but does not provide Implementation, because it will be provided by child classes of BaseValidator class). When ever a class implements Interface, inherits another class the constructor function should call Validators.BaseValidator.initializeBase(this) which would initialize base class. Now coming to the problem read carefully please

Problem

Validators.RequiredFieldValidator = function () {
    Validators.RequiredFieldValidator.initializeBase(this, []);
};
Validators.RequiredFieldValidator.prototype = {};
Validators.RequiredFieldValidator.registerClass("Validators.RequiredFieldValidator", Validators.BaseValidator);
  • RequiredFieldValidator inherits BaseValidator as base class

  • In the constructor calls the initializeBase(this) to initialize base class BUT
    Constructor in the BaseClass throws a error.

Question

How am i supposed to emulate a abstract class with Microsoft Asp.net Ajax

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T13:25:53+00:00Added an answer on May 26, 2026 at 1:25 pm

    In the constructor calls the initializeBase(this) to initialize base class BUT Constructor in the BaseClass throws a error

    Validators.RequiredFieldValidator = function () { };

    What’s wrong with simply not calling the super constructor. If the constructor your inheriting from is meant to be abstract (a useless thing to do) then simply don’t ever call it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Note that I am not asking which to choose (MVC or MVP), but rather
NOTE : In hindsight, I realize this may seem like a stupid question, but
I want to perform simple validation against multiple fields. Please note these fields are
How would you do this PHP switch statement? Also note that these are much
NOTE: XMLIgnore is NOT the answer! OK, so following on from my question on
Note: This was posted when I was starting out C#. With 2014 knowledge, I
NOTE: I am not set on using VI, it is just the first thing
Note: Originally this question was asked for PostgreSQL, however, the answer applies to almost
Note : The code in this question is part of deSleeper if you want
Note The question below was asked in 2008 about some code from 2003. As

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.