#include <iostream> #include <cstdlib> using namespace std; class Pen { public: ) { cout<<"write with color:"<<color<<endl; } }; class Pencil : public Pen{ public: ) { cout<<"write with color:"<&l…
函数可以定义 C++ 风格的标量参数默认值,如下所示: Example #3 在函数中使用默认参数 <?php function makecoffee($type = "cappuccino") { return "Making a cup of $type.\n"; } echo makecoffee(); echo makecoffee(null); echo makecoffee("espresso"); ?> 以上例程会输出:…