#include <iostream>
#include "Circle.h"
int main()
{
auto* c1 = new Circle(1.0);
Circle c3 {2.0};
auto c2 = &c3;
Circle c4 {};
std::cout << typeid(c1).name() << std::endl;
std::cout << typeid(*c1).name() << std::endl;
std::cout << typeid(c2).name() << std::endl;
std::cout << std::boolalpha << (typeid(c1).name() == typeid(*c1).name()) << std::endl;
std::cout << std::boolalpha << (typeid(c1).name() == typeid(c2).name()) << std::endl;
return 0;
}
编译结果
P6Circle
6Circle
P6Circle
false
true
这里的6Circle是什么?还有P6Circle?
为什么*c1的类型会与c1的类型不相符?