Solved

Instance of object of ancestors

Posted on 1999-01-08
3
265 Views
Last Modified: 2013-11-23
if i have one ancestor name Form1 and two descendants derived from Form1 name Form2 and Form3, when the application is running the Form2 and Form3 is created, does this two Forms use the same instance of object of ancestors(Form1) ? or it will create the new instance object of ancestors(Form1) for each of them(Form2 and Form3) ?
0
Comment
Question by:dumper
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 12

Accepted Solution

by:
rwilson032697 earned 30 total points
ID: 1355432
Form inheritance works in exactly the same way as class inheritance. When form2 and form3 are created they essentially call their inherited constructors (which correspond to Form1).

The end result is that there are no instances of form1, merely an instance of form2 and form3 (which are really just classes derived from form1).

Does this clear it up for you?

Cheers,

Raymond.
0
 

Author Comment

by:dumper
ID: 1355433
so if i access the variable value in Form1 from Form2, the value will be the same as access from Form3,right ? so Form2 and Form3 is sharing the same instance of Form1 ?
0
 

Expert Comment

by:qdyoung
ID: 1355434
No. There is no instance of TForm1. If you access variable Form1 in Unit1.pas, then you will get assignment error. If TForm1 has a public property named P. The TForm2 instance Form2 in Unit2.pas can assign it to 'ValueA', the TForm3 instance Form3 in Unit3.pas can assign it to 'ValueB' without effect Form2.P
  TForm is also just a VCL class, an object. You can refer to some Object-Oriented tech information.

Regards, Young.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question