Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Look at the following class definition, which statements are legal and which are illegal. Explain why class Vehicals{ private: int sedan; int trucks; int planes;
Look at the following class definition, which statements are legal and which are illegal. Explain why
class Vehicals{
private:
int sedan;
int trucks;
int planes;
int boats;
publics:
Change() { sedans= trucks= planes= boats= 0; }
Change(int s, int t, int p, int b) { sedans= s ; trucks= t; planes= p; boats= b; }
void add(int s=0, int t=0, int p=0, int b=0)
{ sedans+= s; trucks += t; planes += p; boats+= b; }
void subtract(int s=0, int t=0, int b=0, int p=0)
{ sedans-= s; trucks -= t; planes -= p; boats-= b; }
}
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