faqts : Computers : Programming : Languages : Delphi

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

4 of 9 people (44%) answered Yes
Recently 4 of 9 people (44%) answered Yes

Entry

Delphi: Class: Inheritance: What is inheritance?

Sep 27th, 2003 09:45
Knud van Eeden,


----------------------------------------------------------------------
--- Knud van Eeden --- 27 September 2003 - 05:42 pm ------------------

Delphi: Class: Inheritance: What is inheritance?

---

The basic idea is that you can 'copy' information (=variables,
functions and procedures) from another class to your current class.

After which you can 'add' or 'insert' extra information (=variables,
functions and procedures) to your current class, to further adapt it to
your needs.

---
---

Inheritance

One of the most powerful features of classes in Object Pascal is that
they can be extended through inheritance.

---

'Inheritance' means taking an existing class and adding functionality
by deriving a new class from it.

---

The class you start with is called the 'base' or 'ancestor' class,

---

The new class you create is called the 'derived' class.

---

When you derive a class from another 'base' class, the new 'derived'
class gets all the functionality of that 'base' class plus whatever new
features (=variables, functions and procedures) you add.

---

You can add variables, functions and procedures to the new 'derived'
class, but you can not remove anything from what the 'base' class
offers.

---

[book: source: - Teach Yourself Borland Delphi 4 in 21 Days - Kent 
Reisdorph - SAMS - ISBN 0672312867 - Chapter 3 'Classes and Object-
Oriented Programming' - http://www.amazon.com/exec/obidos/tg/detail/-
/0672312867/qid=1064501349/sr=1-1/ref=sr_1_1/103-6292513-4946208?
v=glance&s=books#product-details]

---
---

Note: here 'base' class can also be read as 'parent' class and
'derived' class can also be read as 'child' class.

---
---

Internet: see also:

C#: Class: Inheritance: What is inheritance?
http://www.faqts.com/knowledge_base/view.phtml/aid/24870

C++: Class: Inheritance: What is inheritance?
http://www.faqts.com/knowledge_base/view.phtml/aid/24866

Java: Class: Inheritance: What is inheritance?
http://www.faqts.com/knowledge_base/view.phtml/aid/24864

----------------------------------------------------------------------