Chinaunix首页 | 论坛 | 博客
  • 博客访问: 355188
  • 博文数量: 79
  • 博客积分: 1270
  • 博客等级: 中尉
  • 技术积分: 1370
  • 用 户 组: 普通用户
  • 注册时间: 2011-04-12 08:48
个人简介

freedom~~~~~~~~~~

文章分类

全部博文(79)

文章存档

2014年(10)

2013年(2)

2012年(13)

2011年(54)

分类: C/C++

2011-05-20 16:11:20

  1. #include<iostream>

  2. using namespace std;

  3. class test
  4. {
  5.     public:
  6.         test();
  7.         test(int i,int j);
  8.         void put();
  9.     private:
  10.         int a;
  11.         int b;
  12. };

  13. test::test()
  14. {
  15.     a=1;
  16.     b=2;
  17. }
  18. test::test(int i,int j)
  19. {
  20.     a=i;
  21.     b=j;
  22. }

  23. void test::put()
  24. {
  25.     cout<<b<<endl;
  26. }

  27. int main()
  28. {
  29.     test b(5,6);
  30.     test *p=new test(7,0);
  31.     test *q=new test();
  32.     test k;
  33.     p->put();
  34.     q->put();
  35.     b.put();
  36.     k.put();    
  37. }
阅读(686) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~