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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T01:45:37+00:00 2026-05-19T01:45:37+00:00

Question about OO design. Suppose I have a base object vehicle. And two descendants:

  • 0

Question about OO design.

Suppose I have a base object vehicle. And two descendants: truck and automobile.

Further, suppose the base object has a base method:

Procedure FixFlatTire(); abstract;

When the truck and automobile override the base object’s, they require different information from the caller.

Am I better off overloading FixFlatTire like this in the two descendant objects:

Procedure Truck.FixFlatTire( OfficePhoneNumber: String;
                             NumberOfAxles: Integer): Override; Overload;

Procedure Automobile.FixFlatTire( WifesPhoneNumber: String;
                                  AAAMembershipID: String): Override; Overload;

Or introducing new properties in each of the descendants and then setting them before calling FixFlatTire, like this:

Truck.OfficePhoneNumber := '555-555-1212';
Truck.NumberOfAxles := 18;
Truck.FixFlatTire();

Automobile.WifesPhoneNumber := '555-555-2323';
Automobile.AAAMembershipID  := 'ABC';
Automobile.FixFlatTire();
  • 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-19T01:45:38+00:00Added an answer on May 19, 2026 at 1:45 am

    The approach with properties is pointless. You can’t use polymorphism properly since the functions take different parameters. You should just have distinct methods in the subclasses with the appropriate parameters.

    Now, if you come back with a more complex version in which you only hold a reference to the base class then a different design would be called for, but it would be neither of the ones you have offered so far.

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

Sidebar

Related Questions

Hi: I have a question about how to design and map object class in
I have a question about design winforms. Should I use, or not, group boxes
I've been thinking about this object oriented design question for a while now and
I have question about normalization. Suppose I have an applications dealing with songs. First
This is a question about style and design rather than syntax. I have domain
I have a question about the design of an application I'm working on. I
I was going to ask a question here about whether or not my design
I've recently asked a question on StackoverFlow about the MVC: Can the MVC Design
I recently asked a question about what I called method calls. The answer referred
I have a question about using streams in .NET to load files from disk.

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.