Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // sol-final-ex1.cpp : Defines the entry point for the console application.
- /*
- suppose you have a class a , where the class contain two var (a and b ) as int
- type . construct function to set the var and (out) as output function to print the variable
- write a program to do the following
- 1. define the class A
- 2. Define the object A1 as type of class A
- 3. insert values to (a and b)
- 4. printting the value of (a and b)
- */
- #include "stdafx.h"
- #include "iostream"
- using namespace std;
- class A {
- private:
- int a,b;
- public:
- A(int x,int y) {
- a = x;
- b = y;
- cout << "a = " << a << endl;
- cout << "b = " << b << endl;
- }
- };
- int main()
- {
- A A1(4, 5);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment