當前位置:編程學習大全網 - 電腦編程 - c++:編程類與對象問題

c++:編程類與對象問題

#include <stdio.h>

class Box

{

int length;

int width;

int height;

public:

Box(int a,int b,int c)

{

length=a;

width=b;

height=c;

}

void volume()

{

printf("The volume is:%d\n",length*width*height);

}

};

int main()

{

Box box(1,2,3);

box.volume();

return 0;

}

  • 上一篇:魅特30有汽車遙控功能嗎
  • 下一篇:Aop編程
  • copyright 2024編程學習大全網