摘要:
/*类的继承(1)*/#include"stdafx.h"#include <iostream.h>#include <string.h>class A{public: A() { m_nData = 10; m_nPublic_A = 1; m_nProtected_A = 2; m_nPrivate_A = 3; } //成员函数是在类内 void FunA() { i...
阅读全文
posted @ 2010-01-26 21:53
o无尘o
阅读(168)
推荐(0)
摘要:
/*类成员函数指针的语法*//*****************************类.h文件************************************/#if !defined(AFX_ONLYOBJ_H__BABA5522_94E8_4F53_B979_27F3DD105320__INCLUDED_)#define AFX_ONLYOBJ_H__BABA5522_94E8_4...
阅读全文
posted @ 2010-01-23 18:50
o无尘o
阅读(200)
推荐(0)
摘要:
#include"stdafx.h"#include <iostream.h>//向前声明class A;class B{public: int GetAData( A& obj );};class A{public: int GetData() const { return m_i; } A():m_i(10) { }; //friend关键字函数修饰符 //此函数和类A有友...
阅读全文
posted @ 2010-01-22 17:34
o无尘o
阅读(143)
推荐(0)
摘要:
#include"stdafx.h"#include <iostream.h>#include <string.h>//设计一个学生类,可以统计学生的总人数void GetName(){ cout << "gobal fun" << endl;}class student{public: char m_szName[32];public: stati...
阅读全文
posted @ 2010-01-22 17:28
o无尘o
阅读(211)
推荐(0)
摘要:
/*new delete*/#include"stdafx.h"#include <stdlib.h>#include <iostream.h>#include <string.h>struct student{ student() { cout << "student::student()" << endl; } student( ch...
阅读全文
posted @ 2010-01-21 20:52
o无尘o
阅读(230)
推荐(0)
摘要:
/*类构造函数(4)*/#include"stdafx.h"#include <string.h>#include <iostream.h>class Date{public: //表达式表构造 Date( int nYear = 1980 , int nMonth = 1, int nDay = 1 ) :m_nYear(nYear),m_nMonth(nMonth),m...
阅读全文
posted @ 2010-01-21 20:32
o无尘o
阅读(197)
推荐(0)
摘要:
/*类的构造函数(3)*/ /*******************类文件***********************/ #include"stdafx.h"#include"A.h"//////////////////////////////////////////////////////////////////////// Construction/Destruction/////////...
阅读全文
posted @ 2010-01-21 20:11
o无尘o
阅读(173)
推荐(0)
摘要:
/*类的构造函数(2)*/#include"stdafx.h"#include <iostream.h>class Color{public: Color() { cout << this << " color 无参构造" << endl; } ~Color() { cout << this << " color 析构" &l...
阅读全文
posted @ 2010-01-21 19:48
o无尘o
阅读(180)
推荐(0)
摘要:
/*类的构造函数(1)*/#include"stdafx.h"#include <iostream.h>class Time{private: //私有段 int m_nHour; int m_nMin; int m_nSecond;public: //公有段 //构造函数无返回值,名称是类名 //进入到构造对象已经存在,无法销毁 Time() { init(); cout <...
阅读全文
posted @ 2010-01-21 19:33
o无尘o
阅读(201)
推荐(0)
摘要:
/************************************************************************C语言指针,难吗!!!???不难!************************************************************************//************************************...
阅读全文
posted @ 2010-01-21 16:42
o无尘o
阅读(161)
推荐(0)