本文整理汇总了C++中Base::FunctionX方法的典型用法代码示例。如果您正苦于以下问题:C++ Base::FunctionX方法的具体用法?C++ Base::FunctionX怎么用?C++ Base::FunctionX使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Base
的用法示例。
在下文中一共展示了Base::FunctionX方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testDefaultParams
void testDefaultParams(const char* mode) {
// One object of type Base and one of type derived
Base *base = new Base(mode);
Derived *derived = new Derived(mode);
// Another of type Base pointing to a Derived
Base *base_der = derived;
// Default parameter of the base funtion
base->FunctionX();
// Default parameter of the derived funtion
derived->FunctionX();
// Default parameter of the base funtion again!!!
// Note: they are evaluated according to their static
// type since in this case it's "Base *base_der"
base_der->FunctionX();
base->FunctionY(); // counter: 1
derived->FunctionY(); // counter: 2
base_der->FunctionY(); // counter: 3
base_der->FunctionY(42, 42); // counter: unchanged!
base->FunctionY(); // counter: 4
derived->FunctionY(); // counter: 5
base_der->FunctionY(); // counter: 6
delete base;
delete derived;
}