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

📄 test.h

📁 1.源码太简单 2.不是源码 3.缺少文件 4.所选类别和开发环境不对 5.乱写说明或说明不够认真 6.压缩文件有密码 7.源码重复或已经存在
💻 H
字号:
#include <iostream>
#include <string.h>
using namespace std;

class TwoValues
{
private:
	int a;
	int b;
public:
	TwoValues(int i,int j)
	{
		a=i;
		b=j;
	}
	//friend class Min;
	void show(int a)
	{
		cout<< a << " " <<b;
	}
};

class Min
{
private:
	int a;
public:
	Min(int j)
	{
		a=j;
	}
	int geta()
	{
		return a;
	}
	int min(TwoValues x);
};
int Min::min(TwoValues x)
{
	//return x.a<x.b?x.a:x.b;
	//x.show(12);
	return 0;
}

class base
{
public:
	int i;
public:
	virtual void f()
	{
		cout<<"base f()";
	}
	virtual void a(float x)
	{
		cout<<"base a(float)";
	}
	void b(float x)
	{
		cout<<"base b(float)"<<x;
	}
	void c(float x)
	{
		cout<<"base c(float x)";
	}
	friend void sum(base b);
	void seti(int num)
	{
		i=num;
	}
	int geti()
	{
		return i;
	}
	 int a()
	{
		this->i=10;
	}
};

class derived:public base
{
private:
	int j;
public:
	virtual void a(float x)
	{
		cout<<"derived a(float)";
	}
	void b(int x)
	{
		cout<<"derived b(int)";
	}
	void c(float x)
	{
		cout<<"derived c(float x)";
	}
	void f()
	{
		cout<<"derived";
	}
	void setj(int num)
	{
		j=num;
	}
	int getj()
	{
		return j;
	}
};
const int SIZE=10;
template <class StackType> class stack
{
	StackType stck[SIZE];
	int tos;
public:
	stack()
	{
		tos=0;
	}
	void push(StackType ob);
	StackType pop();
};
template <class StackType> void stack<StackType>::push(StackType ob)
{
	if (tos==SIZE)
	{
		cout<<"stack is full";
		return;
	}
	stck[tos]=ob;
	tos++;
}
template<class StackType > StackType stack<StackType>::pop()
{
	if (tos==0)
	{
		cout<<"stack is empty";
		return 0;
	}
	tos--;
	return stck[tos];
}
void sum(base b)
{
	cout<<b.i;
}

// class Strin
// {
// public:
// 	Strin(const char *str=NULL);
// 	Strin(const Strin &other);
// 	~Strin(void);
// 	Strin & operator =(const Strin &other);
// public:
// 	char *m_data;
// };
// Strin::Strin(const char *str)
// {
// 	if (str==NULL)
// 	{
// 		m_data=new char[1];
// 		*m_data='\0';
// 	}
// 	else
// 	{
// 		size_t length=strlen(str);
// 		m_data=new char[length+1];
// 		strcpy(m_data,str);
// 	}
// }
// Strin::~Strin(void)
// {
// 	delete []m_data;
// }
// Strin::Strin(const Strin &other)
// {
// 	size_t length=strlen(other.m_data);
// 	m_data=new char[length + 1];
// 	strcpy(m_data,other.m_data);
// }
// Strin& Strin::operator=(const Strin &other)
// {
// 	if (this==&other)
// 	{
// 		return *this;
// 	}
// 	delete []m_data;
// 	size_t length=strlen(other.m_data);
// 		m_data=new char[length+1];
// 		strcpy(m_data,other.m_data);
// 
// 		return *this;
// }

⌨️ 快捷键说明

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