Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- //////////////////////////
- class T
- {
- public:
- int n1;
- int n2;
- float f;
- char c;
- int add();
- T();
- ////////////////////////////////////////////////
- ~T()
- {
- cout << "GoodBye !\n";
- }
- };
- ////////////////////////////////////////////////////////
- int main()
- {
- T t1, tArr[2];
- cout << "n1 = " << t1.n1 << endl;
- cout << "n2 = " << t1.n2 << endl;
- cout << "t1.add() = " << t1.add() << endl;
- return 0;
- }
- ////////////////////////////////////////////////
- T::T()
- {
- n1 = 100;
- n2 = 12;
- }
- ////////////////////////////////////////////////
- int T::add()
- {
- return n1 + n2;
- }
- /*
- #include <iostream>
- using namespace std;
- //////////////////////////
- class T
- {
- public:
- int n1;
- int n2;
- float f;
- char c;
- int add()
- {
- return n1 + n2;
- }
- };
- ////////////////////////////////////////////////////////
- int main()
- {
- T t1, tArr[77];
- cout << "n1 = " << t1.n1 << endl;
- cout << "n2 = " << t1.n2 << endl;
- cout << "add() = " << t1.add() << endl;
- return 0;
- }
- */
- /*
- #include <iostream>
- using namespace std;
- //////////////////////////
- class T
- {
- public:
- int n1;
- int n2;
- float f;
- char c;
- int add()
- {
- return n1 + n2;
- }
- };
- ////////////////////////////////////////////////////////
- int main()
- {
- T t1, tArr[77];
- cout << "n1 = " << t1.n1 << endl;
- cout << "n2 = " << t1.n2 << endl;
- cout << "add() = " << t1.add() << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement