在写程序的时候,定义类时要在大括号后面加上;

class Point{
public:
Point(int a,int b);
Point(const Point &p);
int getx(Point p);
int gety(Point p);
private:
int x,y;
}

最后大括号一定要加上分号,上面是错误实例,编译出错

ew types may not be defined in a return type

所以一定别忘了结尾的分号;

class Point{
public:
Point(int a,int b);
Point(const Point &p);
int getx(Point p);
int gety(Point p);
private:
int x,y;
};

编译成功。

new types may not be defined in a return type(c++语言编译错误,处理)的更多相关文章

  1. 【转】The final local variable xxx cannot be assigned, since it is defined in an enclosing type

    文地址:http://blog.163.com/benben_long/blog/static/199458243201481102257544/ 本文就自己编程时候遇到的一个问题,简要描述一下,并提 ...

  2. ERROR】Unable to open underlying table which is differently defined or of non-MyISAM type or ...

    Error: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn’t ...

  3. C++编译错误:multiple types in one declaration

    这是在使用QT的时候看到的.这种情况往往是结构体或者是class最后少加了一个分好,加上即可,这个bug找了我好久,mark一下.

  4. VC++ 2010编译错误 fatal error C1189 error This file requires _WIN32_WINNT to be #defined at least

    打开你的C++工程,找到里面的stdafx.h文件,然后把下面的红色内容替换成绿色的 参考:http://blog.csdn.net/dongliqiang2006/article/details/5 ...

  5. VS2010编译错误:fatal error C1189: #error : This file requires _WIN32_WINNT to be #defined at least to 0x

    下面是彻底解决方法:在工程的stdafx.h中添加(如有类似语句,需注释掉)#ifndef WINVER // Allow use of features specific to Windows 95 ...

  6. 转:QT 的点点滴滴 错误总结

    转自:http://blog.csdn.net/lbsljn/archive/2009/12/29/5099590.aspx MinGw + CodeBlock + QT4.5 类定义后面要加&quo ...

  7. c++类与初始化,const

    --c++类与初始化,const --------------------------------2014/09/04 1. 类的定义(头文件.声明文件)看成类的外部接口,一般写成.h头文件. 2. ...

  8. C++ Primer笔记3_默认实參_类初探_名字查找与类的作用域

    1.默认函数实參 在C++中,能够为參数指定默认值,C语言是不支持默认參数的,Java也不支持! 默认參数的语法与使用: (1)在函数声明或定义时,直接对參数赋值.这就是默认參数: (2)在函数调用时 ...

  9. C++编译错误杂记

    目录 2018年12月23日 error: no matching function for call to ××× 2018年12月10日 error: expected ')' before '* ...

随机推荐

  1. EMC (电磁兼容性)

    电磁兼容性EMC(Electro Magnetic Compatibility),是指设备或系统在其电磁环境中符合要求运行并不对其环境中的任何设备产生无法忍受的电磁干扰的能力.因此,EMC包括两个方面 ...

  2. 浅析Java中的native关键字

    浅析Java中的native关键字 native关键字说明其修饰的方法是一个原生态方法,方法对应的实现不是在当前文件,而是在用其他语言(如C和C++)实现的文件中.Java语言本身不能对操作系统底层进 ...

  3. Java-API:java.util.list

    ylbtech-Java-API:java.util.list 1.返回顶部   2.返回顶部   3.返回顶部   4.返回顶部   5.返回顶部 1. https://docs.oracle.co ...

  4. HTTP:HTTP百科

    ylbtech-HTTP:HTTP百科 超文本传输协议(HTTP,HyperText Transfer Protocol)是互联网上应用最为广泛的一种网络协议.所有的WWW文件都必须遵守这个标准.设计 ...

  5. Python使用SMTP模块、email模块发送邮件

    一.smtplib模块: 主要通过SMTP类与邮件系统进行交互.使用方法如下: 1.实例化一个SMTP对象: s = smtplib.SMTP(邮件服务地址,端口号) s = smtplib.SMTP ...

  6. Exception in thread "main" javax.validation.ValidationException: Unable to find a default provider

    Exception in thread "main" javax.validation.ValidationException: Unable to find a default ...

  7. 触摸事件MultiTouch Events

    备注: userInteractionEnabled = NO hidden = YES alpha = 0.0~0.01    //如果上面三个属性被设置了则无法接收触摸事件 1.- (void)t ...

  8. MyBatis总结四:配置文件xml详解

    XML 映射配置文件 MyBatis 的配置文件包含了影响 MyBatis 行为甚深的设置(settings)和属性(properties)信息.文档的顶层结构如下: configuration 配置 ...

  9. C++面向对象类的实例题目五

    题目描述: 编写一个程序,采用一个类求n!,并输出5!的值. 程序代码: #include<iostream> using namespace std; class CFactorial ...

  10. Tensorflow手写数字识别训练(梯度下降法)

    # coding: utf-8 import tensorflow as tffrom tensorflow.examples.tutorials.mnist import input_data #p ...