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
OLEGan [10]
3 years ago
11

Constructors are special methods included in class definitions. a. What is a constructor used for? b. How do constructors differ

from other methods in a class?
Computers and Technology
1 answer:
PIT_PIT [208]3 years ago
6 0

Answer:

(a)A constructor is a special method which is used the initialize the class that means the initialize the object of a class.

(b)There is the following difference between constructor and method in a class.

1. Constructor name has the same name as the class name we do not give any other name to the constructor, on the other hand, it is possible in function to giving any name to function.

2. The constructor does not have return type such as int, void, etc on the other hand function must have a return type.

3.constructor does not return any value on the other hand function are returning the value.

Explanation:

Following are the program of constructor in c++

#include <iostream> // header file

using namespace std; // namespace

class constructor1

{

   public:

   constructor1() // default constuctor

   {

       cout<<" hello brainly:"<<endl;  

   }

void fun() // fuuction

{

cout<< "function:";

}

};

int main() // main function

{

constructor1 ob; // creating object it call default constructor

ob.fun();//  calling the function fun()

  return 0;

}

Output:hello brainly:

function:

In this program, we create a class and create a function "fun" and "default "constructor "from the main function we create the object of a class which calls the default constructor and with the help of object we call the function fun.

You might be interested in
Related to Image Classification
loris [4]
<h3>Answers:</h3>

(1) Train the classifier.

(2) True

(3) Image Pre-processing

(4) Weakly Supervised Learning Algorithm

(5) SIFT (or SURF)

(6) True

(7) True

(8) True

(9) True

(10) Decision Tree Classifier

(11) Softmax


<h3>Explanations:</h3>

(1) In supervised learning, we have given labels (y) and we have input examples (X) which we need to classify. In Keras or in Scikit-learn, we have a function fit(X, y), which is used to train the classifier. In other words, you have to train the classifier by using the incoming inputs (X) and the labelled outputs (y). Hence, the correct answer is: The fit(X,y) is used to <em>train the classifier</em><em>. </em>

(2) This statement is primarily talking about the PCA, which stands for "Principal Component Analysis." It is a technique or method used to compress the given data, which is huge, into compact representation, which represents the original data. That representation is the collection of PCs, which are Principal components. PC1 represents the axis that covers the most variation in the data. PC2 represents the axis that covers the variation less than that of in PC1. Likewise, PC3 represents the axis that covers the variation less than that of in PC2, and so on. Therefore, it's <em>true</em> that the variation present in the PCs decrease as we move from the 1st PC to the last one.

(3) Image pre-processing is the phenomenon (or you can say the set of operation) used to improve and enhance the image by targeting the distortions within the image. That distortions are calculated using the neighbouring pixels of the given pixel in an image. Hence, the correct answer is <em>Image pre-processing</em>.

(4) SVM stands for State Vector Machine. It is basically a classifier, which is used to classify different (given) classes with precision. In simple terms, you can say that it is an algorithm, which is partially based on the given labeled data to predict the inputs. In technical terms, we call it weakly supervised learning algorithm. Hence, the correct answer is: <em>Weakly supervised learning algorithm.</em>

(5) There are many algorithms out there to detect the matching regions within two images. SURF (Scale Invariant Feature Transform) and SIFT (Speeded up Robust Feature) are two algorithms that can be used for matching patterns in the given images. Hence, you can choose any one of the two: SURF and SIFT.

(6) Indeed. Higher the accuracy is, better the classifier will be. However, there is a problem of <em>overfitting</em> that occurs when the accuracy of the classifier is way too high. Nevertheless, mostly, the classifier is better when there is higher accuracy. Hence, the correct answer to your question is <em>true</em>.

(7) True. Gradient descent is the process used to tune the parameters of the given neural network in order to decrease the error and increase the accuracy of the classifier. It calculates and fine-tune the parameters from the output to input direction by taking the gradient of the error function (sometimes called the loss function), which is the technique called backpropagation. Hence the correct answer is true.

(8) True. As explained in the part (5), SIFT which is called  scale-invariant feature transform, is an algorithm used to detech the features or the matching regions within given images. Hence, it's true that scale-invariant feature transform can be used to detect and describe local features in images.

(9) True. Clustering is indeed a supervised classification. In clusterning, we use graphs, which contains different data points in the form of clusters, to visualize the data as well. Imagine we have 7 fruits, out of which we know 6 of them, and we have to predict the 7th one. Let's say, 3 are apples and 3 are oranges. The set of apples is one cluster, and the set of oranges is another cluster. Now if we predict the 7th one by using the clustering technique, under the hood, that technique/algorithm will first train the model using the 6 fruits, which are known and then predict the 7th fruit. This kind of technique is a supervised learning, and hence, we can say that clustering is a supervised classification.

(10) In machine learning, Decision Tree Classifier is used to predict the value of the given input based on various known input variables. In this classifier, we can use both numeric and categorical values to get the results. Hence, the correct answer is <em>Decision Tree Classifier.</em>

(11) <em>Softmax </em>is the function which is used to convert the K-dimensional vector into the same shaped vector. The values of the Softmax function lies between 0 and 1, and it is primarily used as an activation function in a classification problems in neural networks (or deep neural networks). Hence, the correct answer is Softmax.

6 0
3 years ago
Using the find and replace tool would be most appropriate when
mafiozo [28]

A. Changing the company name when the same letter is sent to different companies

The find and replace tool is meant to help replace all instances of a certain piece of text with a different piece of text.

For example, if a letter was sent to Company A, the find and replace tool could change every time the letter says “Company A” and make it say “Company B” instead so the same letter could be sent to Company B.

3 0
4 years ago
Read 2 more answers
Question 1:
RideAnS [48]

Answer:

1. A

2. B

3. C

hope this helps in some way

6 0
3 years ago
What is a BUG in terms of computer programming?
diamong [38]

Answer:

C

Explanation:

4 0
3 years ago
Which is true about routers and switches?
Pepsi [2]

Answer:

Routers control traffic between networks while switches control traffic within a network

Explanation:

Router and switches both are used to control the traffic. In local area network, different computer are connected with each other with in the organization or network. Switch is used to connect all the computers or devices in the local area network (LAN). The switch is responsible for connecting all the computers in the LAN and controlling the traffic within the LAN network.

On the other hand, Wide Area Network (WAN) is consist of multiple number of  Local Area Networks (LANs). To connect all the LAN router is used. Router is responsible for connecting all the networks in the WAN and also responsible for controlling traffic between different networks.

5 0
3 years ago
Other questions:
  • ____ was the first-generation cellular telephone system.​ a. ​Advanced Mobile Phone Service (AMPS) b. ​Global System for Mobile
    12·2 answers
  • _____ refers to the physical components used to collect, store, organize, and process data and to distribute information
    7·1 answer
  • Bitlocker uses the computer's __________ chip to store encryption keys and does not rely on individual user credentials. securit
    10·1 answer
  • Pressing the Ctrl+Home keys moves the insertion point to the
    12·2 answers
  • What is a nonlinear presentation?
    14·2 answers
  • Can someone please help me on these short short questions marking Brainly computer modeling people please help
    14·1 answer
  • Creative Commons material often costs money to use.<br><br> True<br> False
    9·2 answers
  • Segregation based on laws is called _____
    11·2 answers
  • ফাইল ও ফোল্ডারের মধ্যে পার্থক্য কি এবং ৫ টি ইনপুট ডিভাইসের নাম কি​
    7·2 answers
  • When you add encryption to a powerpoint presentation what does it do
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!