f0910.cpp
Upload User: puke2000
Upload Date: 2022-07-25
Package Size: 912k
Code Size: 1k
Category:

CSharp

Development Platform:

Visual C++

  1. //=====================================
  2. // f0910.cpp
  3. // test member object create order
  4. //=====================================
  5. #include<iostream>
  6. using namespace std;
  7. //-------------------------------------
  8. class A{
  9. public:
  10.   A(int x){ cout<<"A:"<<x<<"->"; }
  11. };//-----------------------------------
  12. class B{
  13. public:
  14.   B(int x){ cout<<"B:"<<x<<"->"; }
  15. };//-----------------------------------
  16. class C{
  17.   A a;
  18.   B b;
  19. public:
  20.   C(int x,int y):b(x),a(y){ cout<<"Cn"; }
  21. };//-----------------------------------
  22. int main(){
  23.   C c(15, 9);
  24. }//====================================
  25.