con_init.cpp
上传用户:dq031136
上传日期:2022-08-08
资源大小:802k
文件大小:0k
源码类别:

VC书籍

开发平台:

C++ Builder

  1. #include <iostream.h>
  2. class object
  3.  {
  4.    public: 
  5.      object::object(void);
  6.      void show_object(void);
  7.    private:
  8.      int a;
  9.      int b;
  10.      int c;
  11.  };
  12. object::object(void) : a(1), b(2), c(3) { };
  13. void object::show_object(void)
  14.  {
  15.    cout << "a contains: " << a << endl;
  16.    cout << "b contains: " << b << endl;
  17.    cout << "c contains: " << c << endl;
  18.  }
  19. void main(void)
  20.  {
  21.    object numbers;
  22.    numbers.show_object();
  23.  }