简体   繁体   中英

What is the differences between Records, Class, and Units/Module in Pascal

i had struggle over those 3 things in pascal and for some reason i find them quite simillar and i didnt know in what kind of condition i should use them.

does records just like how do we record file? like array does?

and for units, i find some samples that shows me units are just like a basic formulas about something and we can reuse or calls them on the main program and uses the formulas/units by some variable we created?

pls let me know more about those. I'm very new to pascal and for some notes the other language i know is C#(basic). Thank You.

It sounds like you are using some version of Object Pascal.

In the case of a record and a class, the two are very close to being the same thing. A class is effectively a record that allows the definition functions that operate on the class.

In C++ a record is aa struct and a class is also a class. However, in C++ a struct and a class are absolutely identical. In Object Pascal's they are not identical but are similar.

A module is a unit of compilation. A module can define classes and record.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM