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 answer is A. Zareem takes good notes in class to know the lesson better.
Explanation:
Intrinsic motivation occurs if individuals act based on inner interests or rewards such as feeling proud of one-self. This is the opposite of extrinsic motivation that involves external factors such as punishments, rewards, pressure from others, etc. According to this, the only one that is an example of intrinsic motivation is "Zareem takes good notes in class to know the lesson better" because the action (taking good notes) is triggered by Zareem's own interest in learning rather than by any external factor.
the answer is d plz let me know if i got it right
The Linux commands to be used in moving files include the following:
- mv/home/placy/confid_wh/home/bcassini
- mv/home/placy/projplan_wh/home/bcassini
<h3>What is a
Linux command?</h3>
A Linux command can be defined as a software program (utility) that is designed and developed to run on the command line, so as to enable an end user perform both basic and advanced tasks by entering a line of text.
In this scenario, the Linux commands to be used in performing various tasks include the following:
- Switch user (su), and then enter the password (1worm4b8).
- Move (mv)/home/placy/confid_wh/home/bcassini
- Move (mv)/home/placy/projplan_wh/home/bcassini
- Use ls-l/home/bcassini to verify the new location files.
<u>Note:</u> You've to log in as the root user (placy) before you can move his files.
Read more on Linux commands here: brainly.com/question/25480553
#SPJ1