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

📄 pointer.cpp

📁 一个指针的例子,C++语言,我在初学C++时写的,大家请多指教
💻 CPP
字号:
// Pointer.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream>
using namespace std;
#include "date.h"
#include "point.h"


int main(int argc, char* argv[])
{	
	// 对象数组
	date  days[10];

	// this指针
	cout<<date::today().add_year(8).add_month(23).string_rep()<<endl;
	cout<<date::today().string_rep()<<endl;

	//指向类成员的指针
	Point pt(3,4);
	cout<<pt.cal_dist(Point(0,0))<<endl;
	int Point::*px;
	px=&Point::x;
	cout<<"x is : "<<pt.*px<<endl;
	int *p=&pt.x;
	cout<<"x is : "<<*p<<endl;

	float (Point::*pdist)(Point&);
	pdist=&Point::cal_dist;
	cout<<(pt.*pdist)(Point(10,11))<<endl;	
	return 0;
}

⌨️ 快捷键说明

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