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

Constructor Chaining

$
0
0

Can you tell me how to do this in COBOL (C# as the example). I’ve highlighted the constructor chaining method in yellow.

 

public class Car

{

     private Driver driver;

     public Driver Driver

     {

           get { return driver; }

           set { driver = value; }

     }

 

     public Car()

           : this (new Driver())

     {

           Driver.Name = "Speed Racer";

     }

          

     public Car(Driver driver)

     {

           this.driver = driver

     }

}

 

public class Driver

{

     private string _name;

     public string Name

     {

           get { return _name; }

           set { _name = value; }

     }

}

 


Viewing all articles
Browse latest Browse all 4356

Trending Articles



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