Log On
Embarcadero Home
Watch, Follow, &
Connect with Us
Share This
QualityCentral
Communities
Articles
Blogs
Resources
Downloads
Help
QualityCentral
Delphi-BCB
Compiler
Delphi
Language
Overloading
Global
Method
You are not logged in.
Help
Print
Public Report
Report From:
Delphi-BCB/Compiler/Delphi/Language/Overloading/Method
[ Add a report in this area ]
Report #:
16089
Status:
Open
Covariant Returns
Project:
Delphi
Build #:
9
Version:
9.0
Submitted By:
Gideon Sireling
Report Type:
Suggestion / Enhancement Request
Date Reported:
9/20/2005 2:39:28 AM
Severity:
Infrequently encountered problem
Last Updated:
3/20/2012 2:24:39 AM
Platform:
All platforms
Internal Tracking #:
257097
Resolution:
None
(Resolution Comments)
Resolved in Build:
:
None
Duplicate of:
None
Voting and Rating
Overall Rating:
(4 Total Ratings)
4.00 out of 5
Total Votes:
30
Description
An overriding method should be able to declare a return type which descends from the return type of the overriden method.
See Steps for a simplified example.
More thorough example (using C#):
http://blogs.msdn.com/cyrusn/archive/2004/12/08/278661.aspx
Steps to Reproduce:
type
TFood = class
end;
TWine = class(TFood)
end;
TServer = class
function Serve: TFood; virtual;
end;
TButler = class(TServer)
function Serve: TWine; override; //Covariant return instead of TFood
end;
function TServer.Serve: TFood;
begin
Serve := TFood.Create;
end;
function TButler.Serve: TWine;
begin
Serve := TWine.Create;
end;
Workarounds
None
Attachment
None
Comments
Rob Kennedy at 10/5/2005 8:34:12 PM
-
This report would be better if it described what it is it's requesting. It should have a description of what it means to support covariant return types. I know what they are, and the relevant people at Borland should know what they are, but not everyone does, and people won't vote for feature requests they don't understand.
Also, this report could stand to have a better example. The one with THTTPSSession just looks like it's a typo with an extra S. Provide something that better illustrates what covariant returns are. Also, describe some cases for why it would be useful.
View Your Reports
Search
Server Response from: ETNACODE01
Developer Tools
Blackfish SQL
C++Builder
Delphi
FireMonkey
Prism
InterBase
JBuilder
J Optimizer
HTML5 Builder
3rdRail & TurboRuby
Database Tools
Change Manager
DBArtisan
DB Optimizer
ER/Studio
Performance Center
Rapid SQL
Technical Articles
Tutorials
White Papers
Press Releases
Newsletters
Add Content (GetPublished)
Audio
Audio & Video
Video
Bugs & Suggestions (QualityCentral)
Discussion Forums
Examples (CodeCentral)
Tags
Technology Partners
Downloads
Free Trials
Registered User Downloads
Beta Programs
Add Content (GetPublished)
Articles
Blogs
Bugs & Suggestions (QualityCentral)
Discussion Forums
Examples (CodeCentral)
Member Services
About
Connect with Us