Tutorial part II Flashcards

1
Q

What is the difference between an Object and a Tuple

A

They provide inheritance and information hiding.
Because objects encapsulate data, the T() object constructor should only be used internally and the programmer should provide a proc to initialize the object (this is called a constructor).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How to checko a type of an object

A

with ‘of’ operator

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How to set a field of an object public

A

with the ‘*’ after the field name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How to define an object

A

type
Person = ref object of RootObj
name*: string # the * means that name is accessible from other modulHes
age: int

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How to define an inheritance

A

whit the object of operator

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the convention to create an object without inheritance

A

using the RootObj

How well did you know this?
1
Not at all
2
3
4
5
Perfectly