What is the output of this program?
1. #include2. using namespace std; 3. class number 4. { 5. int i; 6. public: 7. int geti(); 8. void puti(int j); 9. }; 10. int number::geti() 11. { 12. return i; 13. } 14. void number::puti(int j) 15. { 16. i = j; 17. } 18. int main() 19. { 20. number s; 21. s.puti(10); 22. cout << s.geti( ); 23. return 0; 24. }
Which special character is used to mark the end of class?
What is the output of this program?
1. #include2. using namespace std; 3. class sample 4. { 5. private: 6. int var; 7. public: 8. void input() 9. { 10. cout << var; 11. } 12. void output() 13. { 14. cout << "Variable entered is "; 15. cout << var << "\n"; 16. } 17. }; 18. int main() 19. { 20. sample object; 21. object.input(); 22. object.output(); 23. object.var(); 24. return 0; 25. }
How many objects can present in a single class?