A C ++ programmer's Delphi learning notes

zhaozj2021-02-17  36

A C programmer's Delphi learning notes

Speaking of your mind, standing in a C programmer's position, there is such a little to use Delphi developers. Just a few weeks ago, I also wrote the dignity of C . Various reasons, today I have to learn Delphi, familiar with Delphi, and I will not be impatient with life.

I gave my fifteen days, I don't know if I can't you master a language? I chose Marco Cantu's "Delphi from the entrance to" and "Delphi Advanced Development Guide" as a learning book. The first book is called "from introduction to proficiency", but if you are not familiar with an OOP language, then this book is not suitable for you. For me, it is right. The total thickness of the second book has a total of 1,500 pages. Well, one hundred and one hundred pages will be almost, I hope I can do it.

I decided to record my thinking and confusion, as I entered the new field of remember, I hope to provide a little help for the same way. An environment "Want to do something, you must first sharpen your equipment", it is very important to familiarize the development environment. Different from the MDI interface of the VC, Delphi uses multiple independent form design. Does this indicate that Borland has advocated the interaction between components? I secretly guess.

1.Desktop settings can be separated from Project, and Desktop settings are prioruously for Project settings.

The 2.to-do list is a good tool for reminding yourself or others.

3.appbrowser feels very similar to the main interface of the VC. It also provides functions such as symbolic prompts, Code Completiont. Well, there is also a Class Completion in VC, which can be automatically completed between the declaration and the realization.

4. The concept of project group, a bit like the .NET platform, but .NET is multi-language collaboration.

The core of two language delphi is a VCL library. Its basis is Object Pascal. "From the introduction to the proficiency", "Object" is said to use the two chapters, but only the word does not mention "pascal". Well, it's okay, I remember.

1.Use is used to reference external units. Unlike the header file, USE has no transfer.

2. Delphi uses the reference object model, the object variable only holds an object reference, no longer hold the object itself, and all objects are manually assigned.

3. Delphi's package is very strange, the setting of the class member access is only role outside the unit. Within the unit, you can access the class private member from the outside of the object. Friends explain that it is equivalent to C friends, and it is important to be big. Is the friendship be two-way? (Use the Unit method as a friend, A can access B, B be able to access a) Friendship has the transfer property? (Use the Unit to use as a friend, A can access B, B can access C, and A must access C). In my opinion, this concept of friends is incompatible. I hope that one day I can understand the consideration of Delphi.

4. After the declaration of the object variable, the actual generation of the Delphi object needs to be called the constructor. The constructor is a special type of method, which is inherited from TOBJECT and overloaded. Do not use the keyword and use the class method to construct the object, I think this is a unique usage of single inheritance.

5. There is a dynamically created TButton example in the book. Use CREAT to create an object, but it is useless to explicitly release.

. I suspect that memory leaks will happen, and I think about it, it is responsible for the release of TButton's container TForm, and my friend confirmed my thoughts. Delphi avoids the trouble of manually release memory.

6.Delphi's keyword is annoying, long and more, there are more places to type. The benefit is to provide more information for the compiler to find the error and speed compilation. 7. Due to the reference object model, there is no longer a direct object access in C , only a problem that the pointer and the polymorphic mechanism are only active.

8. Use Message to point out the method you can handle, hey, let me think of OWL, Borland's similar extension of C language is really nostalgia.

9. A large number of dynamic type conversions, which is the characteristics of Pascal?

10. Form inheritance, as if the properties of the control can be inherited.

11. Very strange design. There is a class of methods, but the class variable is not required to simulate the variables of the UNIT.

12. If my guess is good, the Events of the control should be "object method pointer".

13. Extremely powerful mechanism: class reference, which can be dynamically established in the same form. Similar to C , I am afraid to use Builder mode.

14. Parameter objects are passed by reference, assign values ​​by reference, only partial classes provide ASSIGN methods to copy objects. Hey, the value of C , I miss.

15.FinalLyl! Solved the problem of resource release in C to high tips. But why can't you use ExcePt? do not understand.

16. Attributes and events? ? It's really customized for VCL. In fact, attributes and events are not an object-oriented necessary elements.

17. I think the entrustment model of VCL event processing is similar to Java. Just Java's Listener can handle more

The existence of Listener, Delphi's event attribute seems to be able to handle one? However, it is much more than the processing speed.

18.a) Routine Register, D) installed from Tcomponent class inheritance, B) new construction programs, c). The convenience created by the VCL component is really touched.

19. The book says that VCL is better than ActiveX, because ActiveX has no complete inheritance mechanism, I dare not agree. Aggregation is the mechanism that is first inherited.

20. Butterface, ugly! ! I even doubt whether this is the design of Hejlsberg. It is completely like a temporary patchwork language component for COM, which is uncoordinated with an overall household. The interface itself is powerful, but the bad design will make it use into a pain. In addition to COM and multiple inherits, I think no one is willing to use it.

All, Object Pascal gave me a deep image. Next, I will learn VCL, and how Borland is how to make the ingredients of such languages, assemble the weapons developed. (Renew)

转载请注明原文地址:https://www.9cbs.com/read-29017.html

New Post(0)