Answer:
#include <iostream>
using namespace std;
class ProblemSolution {
private:
int num1, num2;
public:
ProblemSolution(int n1, int n2) {
num1 = n1;
num2 = n2;
}
int calculateSum() {
int sum = 0;
sum = num1 + num2;
return sum;
}
void printSum() {
// calculateSum will return sum value that will be printed here
cout <<"Sum = "<< calculateSum();
}
~ProblemSolution() {
cout << "\nDestructor is called " << endl;
};
};
int main() {
int a, b;
cout << "Enter a: ";
cin >> a;
cout << "Enter b: ";
cin >> b;
// Initiallizing object pointer of type ProblemSolution
ProblemSolution *objPtr = new ProblemSolution(a,b);
// printing Sum
objPtr->printSum();
// delete objPtr to relaease heap memory :important
delete objPtr;
return 0;
}
Explanation:
we will initialize a pointer "objPtr" and initallize the constructor by passing 2 values a and b followed by the keyword "new". the keyword "new" allocates memory in the heap. we can access class member functions using arrow "->". it is important to delete objPtr at the end of the program so that the heap memory can be freed to avoid memory leakage problems.
The process of engineering typically starts with brainstorming.
Answer:
temperature
Explanation:
Temperature is one of the three factors known to have remarkable influence on the effectiveness of chemical sanitizers. These sanitizers generally perform best at temperature range of 13 – 49 degrees centigrade.
Also, contact time is one of the factors that is needed for the sanitizers to effectively kill the microorganisms. The item to be cleaned should come in contact with the chemical for the recommended period of time.
The A. Primary cell can not be recharged or the primary cell is not a rechargeable cell. The choices above are the several types of the battery cell which are used for preserving electric energy. There are two major types of the battery cell which are the primary and the secondary cell based on its recharging ability<span>. The other choices besides the primary cell are the secondary cell.</span>
Answer:
def short_strings(string_list):
short_list = []
for s in string_list:
if len(s) < 20:
short_list.append(s)
return short_list
Explanation:
* The code is in Python.
- Create a function called short_strings that takes one parameter, string_list
- Create an empty list called short_list to hold the strings that are less than 20 characters
- Initialize a for loop that iterates through the string_list. Check if there are strings that are less 20 characters in the string_list. If found, put them in the short_list
- Return the short_list