Solved

Instance of object of ancestors

Posted on 1999-01-08
3
248 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
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Intraweb submit form as a POST request 4 303
build html 5 client that connect to indy Tidtcpserver 3 395
oracle global variables 4 68
creating threads in delphi 1 103
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

776 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