标准库的C 问题
C++ issue with standard library
我发表了这篇文章,因为我一生中的第一次是Visual Studio社区的难以理解的错误2017:
我根本无法在我的所有类中使用STD的其他成员,然后在Main.cpp中使用" Nullptr_t"。当我写下" std ::"时,Visual的自动完成仅暗示我" nullptr_t"。这是无法理解的。
main.cpp代码:
#include <SFML/Graphics.hpp>
int main()
{
return 0;
}
点类代码:
#pragma once
class Point
{
private:
float _x;
float _y;
public:
Point();
Point(float x, float y);
Point(const Point& p);
~Point();
float getx() { return _x; }
float gety() { return _y; }
void setx(float x) { _x = x; }
void sety(float y) { _y = y; }
};
/**********************************************************************************************************************************************/
#include "pch.h"
#include "Point.h"
Point::Point()
{
_x = 0.0;
_y = 0.0;
}
Point::Point(float x, float y)
{
_x = x;
_y = y;
}
Point::Point(const Point& p)
{
_x = p._x;
_y = p._y;
}
Point::~Point()
{
}
六边形类:
#pragma once
class Hexagon
{
private:
Point _center;
float _diameter;
public:
Hexagon();
Hexagon(Point center, float diameter);
~Hexagon();
};
/*****************************************************************************************************************************************************************************************
#include "pch.h"
#include "Hexagon.h"
#include "Point.h"
Hexagon::Hexagon() : _center()
{
_diameter = 10;
}
Hexagon::Hexagon(Point center, float diameter) : _center(center)
{
_diameter = diameter;
}
Hexagon::~Hexagon()
{
}
您只需要包含iostream库或添加此代码行,您需要它。
。#include<iostream>
相关文章:
- 标准::enable_if 和标准::is_arithmetic 作为模板参数的问题
- 标准对此指向成员函数类型模板参数有何说明?是我的代码有误,还是 MSVS 16.6 有问题?
- 关于标准::condition_variables的两个问题
- 标题与标准标题具有相同名称但大小写不同的问题
- 我有一个关于标准::矢量<shared_ptr>的问题
- 从标准输入读取多个类型时出现问题
- 复杂的标准::地图,结构,标准::d问题
- C++ 标准::矢量<int>问题
- 标准::enable_if的基本用法问题
- 关于实施标准::add_pointer的问题
- 标准::Ofstream Open的Klocwork问题
- 得到~对标准输出没有回应~在黑客排名问题上
- C++ 标准::字符串意外更改。我认为这个问题是关于深和浅拷贝的
- 标准容器的C 违反问题
- 关于"使用命名空间标准"的问题?
- 一些编码约定/标准实践问题
- 标准库的C 问题
- 标准::p空气分段构造函数中的可变参数模板问题
- 程序不输出正确的标准偏差.另外,验证问题
- C++ 标准库堆栈使用情况.推送浮点数组时出现问题