1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
White raven [17]
3 years ago
9

Create a class that represents an employee. This class will have three constructors to initialize variables. If the constructor

doesn't provide a parameter for a field, make it either "(not set)" or "0" as appropriate.
Computers and Technology
1 answer:
lawyer [7]3 years ago
8 0

Answer:

Following are the class  employee in which we create a three constructor  to initialize variables.

class employee// class

{

   public:

   int ID,age1 ; // variables

   string name1;

   employee() // constructor initialize the member with 0 when no constructor is called  

   {

     name1="0";

     age1=0;

     ID=0;

     cout<<ID<<name1<<age1;

   }

   employee(int id ,string name ,int age ) // constructor 2

   {

      ID=id;

      name1=name;

       age1=age;

       cout<<ID<<name1<<age1<<endl;

       

   }

 

   // Copy constructor

   employee(const employee(&p2) ) // constructor3

   {

       ID= p2.ID;

      name1 = p2.name1;

      age1=p2.age1;

       cout<<ID<<name1<<age1<<endl;

       

   }

};

Explanation:

Here  we create a class employee and create a three variable  ID,age1 and name1 initially  we create a default constructor in this we set all variable to 0 this constructor is call when doesn't provide any parameter to constructor after that we create a parametrized and copy constructor.In the main function we call these constructor .

Following are the program in c++ language

#include <iostream> // header file

#include <string>

using namespace std;

class employee// class

{

   public:

   int ID,age1 ; // variables

   string name1;

   employee() // constructor initialize the member with 0 when no constructor is called  

   {

     name1="0";

     age1=0;

     ID=0;

     cout<<ID<<name1<<age1;

   }

   employee(int id ,string name ,int age ) // constructor 2

   {

      ID=id;

      name1=name;

       age1=age;

       cout<<ID<<name1<<age1<<endl;

       

   }

 

   // Copy constructor

   employee(const employee(&p2) ) // constructor3

   {

       ID= p2.ID;

      name1 = p2.name1;

      age1=p2.age1;

       cout<<ID<<name1<<age1<<endl;

       

   }

};

int main() // main function

{

cout<<"first constructor"<<endl;

employee e; // call constructor doesn't provide a parameter

cout<<endl<<" second constructor"<<endl;

employee e1(13,"ss",67);// call the second constructor

cout<<" third constructor"<<endl;  

employee p2 =e1;// call third constructor

return 0;

}

Output:

first constructor

000

second constructor

3ss67

third constructor

3ss67

You might be interested in
. What type of device is a computer? Where does it use?​
LenKa [72]

Answer:

The answer to this question is given below in the explanation section.

Explanation:

Computer is an electronic and digital device. Computer can be used everywhere in our daily life. You can use a computer to search for something over the internet related to your study etc.

The following fields where you can see the use of computers.

  1. Education
  2. Business
  3. Hospital
  4. Banking sector
  5. Home
  6. Marketing
  7. Government offices
  8. etc

You can see the use of computers everywhere in our daily life.

7 0
3 years ago
Question 9
Irina18 [472]

Answer:

Outsourcing

Explanation:

The boom in collaboration between U.S. companies and workforces in India created a need for Outsourcing.

I believe this is correct, but I'm not 100% certain.

8 0
2 years ago
A _____ is a modeling tool used in structured systems analysis and design (SSAD) analysis model that helps break down a complex
Shalnov [3]

A <em>"DATA FLOW DIAGRAM"</em> is a modeling tool used in structured systems analysis and design (SSAD) analysis model that helps break down a complex process into simpler, more manageable, and more understandable subprocesses

8 0
4 years ago
What is the main advantage of a bitmap image?
frosja888 [35]
The answer is d. Hope this helps
4 0
3 years ago
Is the IOT governable by frameworks? Explain your rationale.
polet [3.4K]

Answer:

Absolutely yes.

Explanation:

IoT is an acronym for Internet of Things. This is a system of network devices connected together in order to transmit data over the internet. And since communication of these devices is over the internet, there's a need for some protocols for control and moderation. Hence, the need for IoT governance frameworks.

Some of the aspects that should be governed by these frameworks are;

i. Data confidentiality:

Data such as Social Security Numbers, Bank Verification Numbers and Credit card details, that are being transmitted in an IoT system should be assured of protection from unwanted usage or access.

ii. Data integrity:

These data should also be assured of consistency and accuracy over a long period of time.

iii. Accountability:

When there is a breach or some sort of mishappening, there has to be a body that would be held accountable.

8 0
3 years ago
Other questions:
  • While visiting a web site during your lunch break, you see a window that states the web site will not operate properly without f
    13·1 answer
  • Can somebody help me with this problem
    10·1 answer
  • The ____ is the configuration of a system documented at the beginning of the project and consists of all necessary system requir
    8·1 answer
  • Quantas calorias os adolescentes devem consumir diariamente?
    14·1 answer
  • Your customer asks you if it would be worth the investment for him to have Ethernet cabling installed to reach each of his works
    6·1 answer
  • An array is stored in contiguous memory locations. You access the individual array value by using the array name followed by the
    6·1 answer
  • Ask the user to input an integer. Print out the next three consecutive numbers.
    14·2 answers
  • What type of chart is good for single series of data​
    15·2 answers
  • A file ____ utility is a utility that shrinks the size of a file(s).
    6·1 answer
  • _________ is an alternative name for the main memory.help me​
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!