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
Elis [28]
4 years ago
15

class secretType { public: static int count; static int z; secretType(); secretType(int a); void print(); static void incrementY

(); private: int x; static int y; }; secretType::secretType() { x = 1; } secretType::secretType(int a) { x = a; } void secretType::print() { cout << "x = " << x << ", y = " << y << "z = " << z << ", count = " << count << endl; } static void secretType::incrementY() { y++; } Consider the accompanying class and member functions definitions. How many constructors are present in the class definition?
Computers and Technology
1 answer:
DanielleElmas [232]4 years ago
5 0

Answer:

The answer to this question can be given as:

In this class definition, there are two constructors.  

Explanation:

In the class definition two constructors are different in type but first we explain constructor that can be as:

Constructor: constructor are special member functions whose task is to initialized as an object of its class.

Rule for defining constructor:

A constructor doesn’t have a return type not even void.

The name of the constructor must be the same as the class name.

A constructor is called automatically when a new instance of an object is created.

Type of constructor:

  1. default constructor.
  2. parameterized constructor.
  3. copy constructor.

In the question there are two type of constructor is used that can be given as:

default constructor:  

The constructor without any parameters is called a default constructor. This type of constructor is called automatically when a new instance of an object is created.

parametrized constructor:

In the parameterized constructor we use at least one parameter in the constructor that is called the parameterized constructor. In the parameterized constructor we can initialize each instance of the class with several values.

Example :

class AB   //define class  

{  

   String name; //define variable

   AB()   //default constructor

   {

   System.out.print("hello...");  //message.

   }

   AB(String name)  //parametrized constructor.

   {  

       this.name = name;  //holding value in name variable.

   }  

}  

class Main  //define class

{  

   public static void main (String[] args)  //main method  

   {  

   AB OB1 =new AB();   //creating class object.

   AB ob2=new AB("XYZ");

   System.out.print(ob2.name);  //print value

   }  

}

Output:

hello... XYZ

You might be interested in
Which printout will result from the snippet of code?
Anna35 [415]

Answer:

These are the supplies in the list:  

[‘pencil’, ‘notebook’, ‘backpack’, ‘pen’, ‘calculator’]

Explanation:

The line return (\n) character will be in the output (so there will be a change of line), but it will NOT be visible as it would have been interpreted as a special character.

So the output will be on 2 different lines, with no \n visible.

If the command would have been: print('These are the supplies in the list:\n', supplies), with single quotes (') instead of double quotes (") then then \n would have been printed but not interpreted as a special character.  At least in most computer language.  Since we don't know of which language the question refers to, we can't be sure at 100%.

7 0
3 years ago
1. Which of the following describes a way of memorizing a poem using a mnemonic device?
xenn [34]

Answer:

Singing the words of the poem to the tune of Happy Birthday"

Explanation:

Mnemonic devices are those tools which can be used to improve a persons ability to remember something efficiently. In short, it a technique to memorize something in short period of time and remember it for longer period of time.

Memorizing a poem by singing it to the tune of Happy birthday is also a technique to remember the poem and memorizing it efficiently.

3 0
3 years ago
Which file types have .exe and .png as their extensions?
cricket20 [7]
EXE files are executable files.
PNG files are picture files like JPEG etc.
7 0
4 years ago
Plz help i need a friends
Butoxors [25]

Answer:

i

Explanation:

3 0
3 years ago
Read 2 more answers
What home ribbon group contains the command used for quickly converting selected cells to a table by choosing a table style?
Anni [7]
The answer would be Styles
6 0
4 years ago
Other questions:
  • Explain Cascading Style Sheets and what they do. Describe their primary function, two effects that this function has on programm
    11·1 answer
  • Which of the following can you use to attach external hardware devices to a computer?
    11·2 answers
  • The ____ command displays the last 10 lines of a text file.
    5·1 answer
  • ________ applications are software in which the vendor hosts the software online over the Internet and you do not to install the
    15·1 answer
  • What does it mean to search an index or the web? (DONT TAKE ANSWERS FROM THE INTERNET!)
    9·2 answers
  • Suppose that outFileis an ofstreamvariable and output is to be stored in the file outputData.out. Which of the following stateme
    14·1 answer
  • Some commands listed in a menu cannot be selected.<br><br><br> True or False
    13·2 answers
  • Different he launc.<br>in function are available with MS-Excel<br>Many​
    14·1 answer
  • Make a program that receives several integers (the program ends when a negative number is entered) and shows how many times the
    14·1 answer
  • 100 POINTSSSSSSS!!
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!