⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 constoverload.cpp

📁 压缩包里有教材<<C++模式设计-基于QT4开源跨平台开发框架>>所有源码
💻 CPP
字号:
#include "constoverload.h"#include <iostream>using namespace std ;inline static double& zero(int index) { /** Returned when there is an index error */    static double _zero = 0 ;    _zero = 0 ;    cerr << "index out of bounds: "  << index<< endl ;     return _zero;}ostream& operator<<(ostream& out, const Point3& v) {    out << '(' << v[0] << ", " << v[1] << ", " << v[2] <<  ')';    return out;}Point3::Point3(double x, double y, double z) {    m_Coord[0] = x;    m_Coord[1] = y;    m_Coord[2] = z;}//startconst double& Point3::operator[](int index) const {    if ((index >= 0) && (index < cm_Dim))        return m_Coord[index];    else        return zero(index);}double& Point3::operator[](int index) {    if ((index >= 0) && (index < cm_Dim))        return m_Coord[index];    else        return zero(index); } //end

⌨️ 快捷键说明

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