Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need help with constructor declaration. I have a class called flower which has the following parameters: //constructor that accepts 3 colors public flower (Color
I need help with constructor declaration. I have a class called flower which has the following parameters:
//constructor that accepts 3 colors
public flower (Color tulip, Color rose, Color daisy)
{ this.tulip = tulip; this.rose = rose; this.daisy = daisy; }
If I want to make a class called garden, and want to make an instance of flower class: what constructor do I use to create a new object flower in the garden class?
Is this right? If not how do I do it?
flower = new flower(tulip, rose, daisy);
Note: I do not need output for this question.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started