Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Where are the constructors?

constructors
0
Posted

Where are the constructors?

0

Seed7 does not need constructors, but you can define normal functions which create a new value in a similar way as constructors do it. Seed7 uses a special create statement ( ::= ) to initialize objects. Explicit calls of the create statement are not needed. The lifetime of an object goes like this: • Memory is reserved for the new object (stack or heap memory make no difference here). • The content of the new memory is undefined (It may contain garbage), therefore a create statement is necessary instead of an assignment. • The create statements copies the right expression to the left expression taking into account that the left expression is undefined. • If the object is variable other values can be assigned using the assign statement ( := ). The assignment can assume that the left expression contains a legal value. This allows that for strings (and some other types which are just references to a memory area) the memory containing the old string value (and not the memory of the object

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123