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 8339473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:53:35+00:00 2026-06-09T04:53:35+00:00

I have model BaseUser.class.php User.class.php UserTable.class.php In user Class I have been override the

  • 0

I have model

BaseUser.class.php
User.class.php
UserTable.class.php

In user Class
I have been override the delete function

class User extends BaseUser {
   function delete(){
    }
}

Now, if i want to call parent delete function …. how ?

Example

$user = new User();
$user->delete();  // will call the overridden delete
$user-> ??  ;     // want to call parent delete
  • 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-06-09T04:53:36+00:00Added an answer on June 9, 2026 at 4:53 am

    Technically this is not possible from the “outside” (the public interface) for good reason.

    If you have understood why (otherwise read below), and you actually know what you do, there is no reason to actually not offer the functionality:

    class User extends BaseUser {
       ... 
       function parentDelete(){
           parent::delete();
       }
       ...
    }
    
    user = new User();
    $user->delete();  // will call the overridden delete
    $user->parentDelete();     // want to call parent delete
    

    However if you ever do that, you should know that you have misused inheritance somehow. This must be an exceptional situation as I can not imagine any situation where you actually need that to do at all.

    So try to formulate why you need that functionality so to give yourself better suggestions.

    Why is that bad?

    For a very simple reason: In your software you do not need to know that $user has a parent or not. That is some detail you should not care at all about.

    That will allow you to replace any user-object you have in your software with a childobject of user later on. This is important as you want to change your software over time.

    If you make the internal detail part of the public interface you are robbing yourself the possibility to keep things flexible. Not being flexible is really a bad situation.

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

Sidebar

Related Questions

I have model User class User < ActiveRecord::Base has_and_belongs_to_many :roles attr_accessible :login, :email, :password,
I have Model class Account: and other model called class Transactions: Now i have
I have model created with visual designer. Now I want to have POCO classes
I have a doctrine class User which is of this hierarchy Doctrine_Record -> BaseUser
I have model Post with boolean field default. Post belongs to User. I want
I have model public class UploadOptionModel { public UploadOptionModel() { OutputFormat = outputFormatList.Select(i =>
I have model: [XmlRoot(ElementName = event, IsNullable=true)] public class Event { public int id
I have model: # encoding: utf-8 class Tag include Mongoid::Document field :name, type: String
Lets say I have model inheritance set up in the way defined below. class
If I have Model.objects.all() I want to get only one object for any content_object=foo,

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.