Print out your answers (or hand write them on paper) and turn them in.
const int * pX = &X; int * const pX = &X; int const * pX = &X;
fcn() {
int a=5;
while(1)
{
int *p = new int();
p = &a;
a++;
}
}
::)?
#include <iostream>
using namespace std;
class myClass {
private:
int a;
public:
void updateval(int u) { a=a+u; }
myClass(int v) { a = v; }
void printval() {
cout<<"\nThe updated value is : " << a << endl;
}
};
int main(void) {
myClass obj1;
obj1.updateval(2);
obj1.printval();
return 0;
}
#include <iostream>
using namespace std;
class myClass {
public:
int a;
void updateval(int u) { a=a+u; }
void printval() {
cout<<"\nThe updated value is : " << a << endl;
}
};
int main(void) {
myClass obj1;
obj1.a = 100;
obj1.updateval(2);
obj1.printval();
return 0;
}