Jump to content

Search the Community

Showing results for tags 'class method'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Delphi Questions and Answers
    • Algorithms, Data Structures and Class Design
    • VCL
    • FMX
    • RTL and Delphi Object Pascal
    • Databases
    • Network, Cloud and Web
    • Windows API
    • Cross-platform
    • Delphi IDE and APIs
    • General Help
    • Delphi Third-Party
  • C++Builder Questions and Answers
    • General Help
  • General Discussions
    • Embarcadero Lounge
    • Tips / Blogs / Tutorials / Videos
    • Job Opportunities / Coder for Hire
    • I made this
  • Software Development
    • Project Planning and -Management
    • Software Testing and Quality Assurance
  • Community
    • Community Management

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Delphi-Version

Found 1 result

  1. Hi Delphi addicts, I want to create an "inherited class property". - I define a class property in Master - Define a local getter in Master, because a getter must be static - Define an abstract class procedure, called by the getter - Implement the class procedure in Child Writing it in Delphi and compiling it, all goes well. When executing the code, the getter raises an abstract error when calling the class procedure. What am I missing? Is there a way to define inheritable polymorf class properties? unit Unit1; interface type TMaster = class private class function GetMasterId: integer; static; {MUST be a static method for a property getter} protected class function GetChildID: integer; virtual; abstract; public class property id: integer read GetMasterId ; end; TChild = class(TMaster) protected class function GetChildID: integer; override; end; implementation { TMaster } class function TMaster.GetMasterId: integer; begin result := GetChildID ; { <= at this point I get an abstract error} end; { TChild } class function TChild.GetChildID: integer; begin result := 1 end; end. procedure TForm2.Button1Click(Sender: TObject); begin Edit1.Text := inttostr(TChild.id) { <= Calling the Child's property} end;
×