Guest User

Untitled

a guest
Sep 18th, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3.  
  4. class Marks
  5. {
  6. public:
  7. int maths;
  8. int science;
  9.  
  10. //Parametrized Constructor
  11. Marks(int mark1,int mark2) {
  12. maths = mark1;
  13. science = mark2;
  14. }
  15.  
  16. void display() {
  17. cout << "Maths : " << maths <<endl;
  18. cout << "Science :" << science << endl;
  19. }
  20. };
  21.  
  22. int main() {
  23. //invoke Parametrized Constructor
  24. Marks m(90,85);
  25. m.display();
  26. return 0;
  27. }
Add Comment
Please, Sign In to add comment