Classes Coding Questions Flashcards
Write a field constructor
public ClassName (type + variableName)
{
variable = Variable;
Etc. weight=Weight;
}
Write a constructor
public ClassName ()
{
variable = appropriateValue;
Etc. weight =0;
}
Write GET and SET
public type NameOfVariable()
{
get {return nameOfVariable; }
set {nameOfVariable = value; }
}
Class Hamper
double hamperWeight;
char nextDayDelivery;
How to instantiate an object?
Hamper hamper = new Hamper ( hamperWeight, nextDayDelivery)
Define an array called artWorksArray that is capable of holding details for 50 items of ArtWork.
ArtWork [] artWorksArray = new ArtWork[50];
How to write a constant variable?
private const type variableName = value;
Etc. double hourlyRate = 20;