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]
3 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]3 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
Why did scientists who study weather need more advanced technology? Check all that apply.
kobusy [5.1K]

Answer:

All options are correct.

Explanation:

All options apply to the question because they all need technology for development and improvement. Scientists needed to develop more technologies in order to attend all their necessities, such as anticipating weather changes, forecasting weather previously, predicting weather behaviour in different places and in one specific place, accounting for reasons and natural resources related to weather changes, and much more. Therefore, technology provides faster and more consistent data for all these informations needed, since all technology tools to study weather were developed according to their specific needs.

4 0
3 years ago
Read 2 more answers
A ___________ variable is declared outside all functions.
velikii [3]

Answer:

B. global

Explanation:

A global variable lives on even when a function returns.

7 0
3 years ago
What is the answer to this binary?
USPshnik [31]
Relating to, using, or expressed in a system of numerical notation that has 2 rather than 10 as a base.
5 0
2 years ago
A visual basic application consists of a single file true or false
saw5 [17]
False. When decompiled you can see all the files required for it to run
3 0
3 years ago
Read 2 more answers
Define a function UpdateTimeWindow() with parameters timeStart, timeEnd, and offsetAmount. Each parameter is of type int. The fu
NARA [144]

Answer:

Here is a UpdateTimeWindow() method with parameters timeStart, timeEnd, and offsetAmount

// the timeEnd and timeStart variables are passed by pointer

void UpdateTimeWindow(int* timeStart, int* timeEnd, int offsetAmount){

// this can also be written as  *timeStart = *timeStart + offsetAmount;

*timeStart += offsetAmount;  //adds value of offsetAmount to that of //timeStart

// this can also be written as  *timeEnd = *timeEnd + offsetAmount;

  *timeEnd += offsetAmount;  } //adds value of offsetAmount to that of //timeEnd

Explanation:

The function has three int parameters timeStart, timeEnd, and offsetAmount.

First two parameters timeStart and End are passed by pointer. You can see the asterisk sign with them. Then in the body of the function there are two statements *timeStart += offsetAmount; and *End+= offsetAmount; in these statements the offsetAmount is added to the each of the two parameters timeStart and timeEnd.

8 0
2 years ago
Other questions:
  • Katie created a web site that automatically scales to fit a cell phone. What kind of design did Katie use?
    12·2 answers
  • opearating system protection refers to a mechanism for controling access by programs, processes, or users to both system and use
    7·1 answer
  • What is the primary uses of cell phone
    12·2 answers
  • Interstate highway numbers Primary U.S. interstate highways are numbered 1-99. Odd numbers (like the 5 of 95) go north/south, an
    8·1 answer
  • What changes should be made in OSI model(Open System Interconnection).
    5·2 answers
  • H e l p ASAP plz <br> and thanks
    9·1 answer
  • I'm showing my friends brainly. Answer with anything so they can see how fast I can get answers.
    10·2 answers
  • You are running your warehouse using Autonomous Data Warehouse (ADW) service and you noticed that a newly configured batch job i
    15·1 answer
  • What is the purpose of a hyperlink in a presentation?
    11·1 answer
  • Why do you want to work from our company?​
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!