注册 登录
编程论坛 C++教室

cout未声明的标识符

雨露均沾 发布于 2017-04-17 08:55, 3194 次点击
程序代码:
// ConsoleApplication1.cpp : 定义控制台应用程序的入口点。
//
#include "iostream"
#include "stdafx.h"

using namespace std;

class Base1
{
public:
    Base1(int D) {  cout<<D; }
    ~Base1() {}
};
class Base2
{
    public:
    Base2(int D) {  cout<<D; }
    ~Base2() {}
};
class Derived : public Base1, Base2
{
public:
    Derived(int A, int B, int C, int D) : Base1(B), Base2(A), b1(D), b2(C) {}
private:
    int b1;
    int b2;

};

int main()
{
    Derived d(1, 2, 3, 4);
    return 0;
}
2 回复
#2
yangfrancis2017-04-19 17:43
注释掉第二行include, 可以运行的
#3
某一天2017-06-01 16:38
#include "stdafx.h" 这个要放在最前边
1