fntemp11.c

来自「开放源码的编译器open watcom 1.6.0版的源代码」· C语言 代码 · 共 28 行

C
28
字号
#include "fail.h"
#include <string.h>

struct Foo {
    Foo &operator <<(const char *string)
    {
	if( strcmp( string, "123456789" ) ) fail(__LINE__);
	return *this;
    }
};

struct Bar {
    char *temp;
};

template <class Type>
    Type &operator <<(Type &type,const Bar &bar)
    { type << bar.temp; return type; }

int main( void )
{
    Foo foo;
    Bar bar;
    bar.temp = "123456789";
    foo << bar;
    _PASS;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?