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

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. QrCode C#生成二维码 及JavaScript生成二维码

    一 C#的二维码    示例: class Program { static void Main(string[] args) { QrEncoder qrEncoder = new QrEncode ...

  2. 开发环境无错,部署至测试环境报错“NoSuchMethodError”OR"NoSuchClassError"

    背景: 实现一个简单的功能,需要用到jedis的jar包连接Redis.在之前便已经有使用jedis,它的版本比较旧,是2.1的.而新实现的功能,在编码的时候使用的是2.8的.在开发环境完成单元测试后 ...

  3. 侯捷STL学习(十)--容器hashtable探索(unordered set/map)

    layout: post title: 侯捷STL学习(十) date: 2017-07-23 tag: 侯捷STL --- 第二十三节 容器hashtable探索 hashtable冲突(碰撞)处理 ...

  4. 数据库:ubantu下MySQL数据库备份方法

    1.编辑/etc/crontab文件设定定时任务,在制定时间执行backup_databases.sh vi /etc/crontab # /etc/crontab: system-wide cron ...

  5. Python类(六)-静态方法、类方法、属性方法

    静态方法 通过@staticmethod来定义,静态方法在类中,但在静态方法里访问不了类和实例中的属性,但静态方法需要类来调用 # -*- coding:utf-8 -*- __author__ = ...

  6. 2010.1.1 CLR 无法从 COM 上下文

    今天做一个程序,sql操作,但是记录数太多,而且sql语句有复杂,就报了这样的错误: CLR 无法从 COM 上下文 0x645e18 转换为 COM 上下文 0x645f88,这种状态已持续 60 ...

  7. HeapCreate深入研究

    本机:win7(x86),4G内存 #include"stdafx.h"#include<windows.h>#include<stdio.h>#inclu ...

  8. 11-18网页基础--第二部分CSS样式属性(1)

    第一课:样式属性 style 样式:style样式不仅可以直接在<body>中设置成整个网页的样式.格式:为了将样式.格式多样化,也可以将style单独抽出来,作为一个独立的个体,放在&l ...

  9. import javax.servlet 出错(真的很管用)

    Error: The import javax.servlet cannot be resolved The import javax.servlet.http.HttpServletRequest ...

  10. java判断姓是否合格 千家姓

    package com.sycx.domain; import java.lang.reflect.Array; public class FirstName { public static bool ...