Quantcast
Channel: Visual COBOL - Forum - Recent Threads
Viewing all articles
Browse latest Browse all 4356

RE: Constructor Chaining

$
0
0

Something like:

      class-id Car.

      01 Driver type Driver property.

      method-id new.

          invoke self::new(new Driver)

          set Driver::Name to "Speed Racer"

      end method.

      method-id new (driver as type Driver)

          set self::Driver to driver

      end method.

      end class.

      class-id Driver.

      01 #Name string property.

      end class.

The 'property' keyword on the 01 level instance fields sets up a private field and a public property.  The # in '#Name' serves to allow the use of a COBOL reserved word (Name) as a data name.  The '#' character is removed from the externalized name.


Viewing all articles
Browse latest Browse all 4356

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>