Perfect Developer basic tutorial 2 This page last modified 2011-10-29 (JAC)

Calling Functions and Constructors Quiz

1. What might the expression myObject.someName represent?

  1. A call to the member function someName of object myObject ?
  2. The value of the member attribute someName of object myObject ?
  3. Either of the above?

c. When calling a function with no parameters, Perfect neither requires nor allows an empty parameter list.


2. If I have declared a class called MyContainer with a default constructor, which of the following is the correct expression to yield an object that type, using the default constructor?

  1. MyContainer
  2. MyContainer()
  3. MyContainer{}

(c). The name MyContainer by itself is a valid type expression. However, to indicate a call to one of its constructors you need to append a parameter list.

Perfect uses curly brackets for constructor parameter lists (whether empty or not), and it uses round brackets for other parameter lists that are not empty.