Consider the class declaration and object declaration


Consider the following class declaration and object declaration in main() class exerclass { private: int p1;int; public: exerclass (int a, int b) {p1=a; p2=b} int get,_p1() {return p1;} int get_p2 {return p2} void combine (int a) {p1=p1+p2+a} }; int main() { exerclass exl (3,4); exerclass *p=&ex1; //pointer object exerclass ex2(7,8); exerclass &ex_r =ex2; // independent object reference return 0; } what is the output in each of the above program? Work each independent of the others 1. cout <get_p1(); 2. ex_p-> combine(6); cout <

get_p1(); 3. cout <combine(5); cout-> ex2.get_p1(); 5. Write a void function display_exer() that displays in a nicely formatted way the data member of an exerclass object. Pass the object to the function by value. 6. Write a void function display_exer() that display in a nicely formatted way the data members of an exerclass object. Pass the object to the function by pointer. 7. Write a void function display_exer() that display in a nicely formated way the eat members of an exerclass object. Pass the object to the function by reference.

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: Consider the class declaration and object declaration
Reference No:- TGS0120838

Expected delivery within 24 Hours