typedef unsigned char BYTE;
BYTE b1;

#include<iostream>
typedef class APrinterClass {
public:
	void printer()
	{
		std::cout << "Print this" << std::endl;
	}
} APrinter;
 

int main()
{
	APrinter obj;
	obj.printer();
	return 0;
}

总结,

  1. typedef可以定义新的变量类型
  2. typedef也可以用于定义一个新的类,作为一种新的变量类型

typedef unsigned char BYTE;
BYTE b1;

#include<iostream>
typedef class APrinterClass {
public:
	void printer()
	{
		std::cout << "Print this" << std::endl;
	}
} APrinter;
 

int main()
{
	APrinter obj;
	obj.printer();
	return 0;
}

总结,

  1. typedef可以定义新的变量类型
  2. typedef也可以用于定义一个新的类,作为一种新的变量类型

相关文章:

  • 2022-12-23
  • 2021-12-12
  • 2021-12-05
  • 2021-05-25
  • 2021-10-20
  • 2021-10-23
  • 2022-01-23
  • 2022-12-23
猜你喜欢
  • 2021-05-28
  • 2021-07-22
  • 2022-12-23
  • 2021-06-01
相关资源
相似解决方案