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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:02:14+00:00 2026-05-28T02:02:14+00:00

Subtypes must be substitutable for their base types Let’s say I have a Bird

  • 0

“Subtypes must be substitutable for their base types”

Let’s say I have a Bird class already, and:

class Parrot extends Bird {
   public function Talk() {
     echo 'Talk';
   }
}

A Bird can’t talk so I can’t substitute a Parrot with a Bird.

This is just a basic example but usually the extended class can do much more then the base class. What am I missing?

  • 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-28T02:02:15+00:00Added an answer on May 28, 2026 at 2:02 am

    The point is a parrot should act like a bird in all ways, so that someone who has a plan for dealing with birds in general won’t be surprised by a parrot they run across. If the parrot happens to be able to talk as well, it doesn’t matter, because their plan doesn’t involve asking birds to talk.

    For example, perhaps they just call $bird->fly() on every bird they get – the ability of a parrot to talk won’t disrupt that activity, so their algorithm still works. But if you invent a sort of bird that can’t fly (an ostrich, say), then you’ve violated the principle, and their general bird-handling algorithm no longer works on all sorts of birds.

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

Sidebar

Related Questions

I have a question concerning subtypes of built-in types and their constructors. I want
Let's say you have a type T and subtypes TSub1 , TSub2 etc. Several
I have an [AllowPartiallyTrustedCallers] class library containing subtypes of the System.DataAnnotations.ValidationAttribute. The library is
I have a model class ServiceRequest < ActiveRecord::Base has_many :services accepts_nested_attributes_for :services ... end
I have the following three models (Rails 2.3.8) class Outbreak < ActiveRecord::Base has_many :incidents,
I have following list of users. StudentBean and ProfessorBean are the subtypes of UsersBean.
I have an application that loads assemblies and looks for types that are subclasses
I have a template class, what I want to do are the following Make
I have a service returning an array of type Party. Party has two subtypes,
<Types> <Type id='1' name='sport'> <SubTypes id='1' name='football' /> <SubTypes id='2' name='tennis' /> </Type> <Type

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.