小编mis*_*ala的帖子

错误:ISO C++禁止非const静态成员的类内初始化

这是头文件:employee.h

#ifndef EMPLOYEE_H
#define EMPLOYEE_H

#include <iostream>
#include <string>
using namespace std;

class Employee {
public:
    Employee(const string &first, const string &last) 
Run Code Online (Sandbox Code Playgroud)

重载的构造函数

    : firstName(first), 
Run Code Online (Sandbox Code Playgroud)

firstName重载的构造函数

      lastName(last) 
Run Code Online (Sandbox Code Playgroud)

lastName重载的构造函数

    { //The constructor start
    ++counter; 
Run Code Online (Sandbox Code Playgroud)

它为每个创建的对象增加一个加号;

    cout << "Employee constructor for " << firstName
         << ' ' << lastName << " called." << endl;
    }

    ~Employee() { 
Run Code Online (Sandbox Code Playgroud)

析构函数cout <<"~Workee()调用"<< firstName <<"<< lastName << endl;

返回每个对象的名和姓

        --counter; 
Run Code Online (Sandbox Code Playgroud)

反减一

    }

    string getFirstName() const {
        return firstName; 
    }

    string getLastName() const {
        return lastName;
    } …
Run Code Online (Sandbox Code Playgroud)

c++ standards static iso compiler-errors

17
推荐指数
2
解决办法
4万
查看次数

Eclipse ADT意外异常'无法运行程序'

我在笔记本电脑上安装了ADT Bundle.我有ubuntu 13.10,但是当我打开ADT时,我看到了这样的消息:

Unexpected exception 'Cannot run program "/home/.../Descargas/adt-bundle-linux-x86_64 20131030/sdk/platform-tools/adb": 
error=2, No existe el archivo o el directorio' while attempting to get adb version from '/home/.../Descargas/adt-bundle-linux-x86_64-20131030/sdk/platform-tools/adb'

[2013-12-25 16:20:14 - adb] Unexpected exception 'Cannot run program "/home/.../Descargas/adt-bundle-linux-x86_64-20131030/sdk/platform-tools/adb": 
error=2, No existe el archivo o el directorio' while attempting to get adb version from '/home/.../Descargas/adt-bundle-linux-x86_64-20131030/sdk/platform-tools/adb'
Run Code Online (Sandbox Code Playgroud)

这是我第一次在android上安装和开发,所以,我不知道该怎么做.有人能帮我吗?

eclipse linux android adt ubuntu-13.10

8
推荐指数
2
解决办法
1万
查看次数

我应该测试模块是否具有某些属性?

我在过去的两个月里一直在编写测试(用JavaScript).并且,我习惯检查模块是否具有某些属性.

例如:

// test/foo.js
const Foo = require('../lib/foo');
const Expect = require('chai').expect;

describe('Foo API', () => {
    it('should have #do and #dont properties', () => {
        Expect(foo).to.have.property('do')
            .and.to.be.a('function');

        Expect(foo).to.have.property('dont')
            .and.to.be.a('function');
        });
     });
});
Run Code Online (Sandbox Code Playgroud)

而且,我一直在想我是否正在做正确的事情.只是想知道一些事情:

  1. 这种模式是"正确的"吗?

    • 它被广泛使用?
    • 还有其他方法吗?
  2. 如果它不"正确"?

    • 为什么?
  3. 它甚至有意义吗?

    • 我的意思是,这是不必要的还是多余的?

javascript testing

7
推荐指数
2
解决办法
869
查看次数