Skip to content
Snippets Groups Projects
Commit 438b920c authored by Marcel Kehrberg's avatar Marcel Kehrberg
Browse files

comments for class Car

parent fdaafc9e
No related branches found
No related tags found
No related merge requests found
using System;
namespace ConsoleApplication1
{
//Class for the objects which get stored in the buffer from the class Producer and deleted from the class Consumer
public class Car
{
static int carId = 0;
private int thisCarId;
// Constructor which sets the car id and increments ++ the carId for the next object
public Car()
{
thisCarId = carId;
carId++;
Console.WriteLine("car created. id = " + thisCarId);
}
public void count()
// Destructor which decrements -- the carId
~Car()
{
for (int i = 0; i < 100; i++)
{
Console.WriteLine(i);
}
carId--;
Console.WriteLine("car deleted. id = " + thisCarId);
}
// Returns the carId for Consumer and Producer so they can get the carId
public int getThisCarId()
{
return thisCarId;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment