Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- class Marks
- {
- public:
- int maths;
- int science;
- //Parametrized Constructor
- Marks(int mark1,int mark2) {
- maths = mark1;
- science = mark2;
- }
- void display() {
- cout << "Maths : " << maths <<endl;
- cout << "Science :" << science << endl;
- }
- };
- int main() {
- //invoke Parametrized Constructor
- Marks m(90,85);
- m.display();
- return 0;
- }
Add Comment
Please, Sign In to add comment