标签: declaration

在c#中将一组成员标记为私有/公共

在c ++类声明中,您可以将一组成员标记为私有或公共,例如

private:
  int x;
  double y;
Run Code Online (Sandbox Code Playgroud)

似乎在c#中没有办法做到这一点.我错了吗?

c# private class declaration members

3
推荐指数
1
解决办法
1385
查看次数

为什么变量以C中的随机值开始

我认为这是错误的,它应该从NULL开始,而不是随机值.如果你有一个带有随机内存地址的指针作为默认值,它可能是一个非常危险的事情,不是吗?

c random variables declaration default-value

3
推荐指数
1
解决办法
211
查看次数

声明一个带有构造函数参数的成员变量

 // In A.h
 class A
 {
  public:
    enum eMyEnum{ eOne, eTwo, eThree };
  public:
    A(eMyEnum e);
 }

 // In B.h
 #include "A.h"
 class B
 {
    B();
    private:
       A memberA;
 }

 // In B.cpp
#include "B.h"
 B::B(void) : memberA(A::eOne)
 {}
Run Code Online (Sandbox Code Playgroud)

'memberA'的声明使用g ++编译器给出了编译错误:错误:'A :: eOne'不是类型

我怎么能克服这个?我只需要创建一个不带参数的默认构造函数吗?

c++ constructor g++ declaration member-variables

3
推荐指数
1
解决办法
3316
查看次数

C++编译器错误:"isLeaf()尚未声明" - 但它确实如此

#include <cstdlib>
#include <iostream>
#include "Node.h"
#ifndef HW4_H
#define HW4_H
using namespace std;
/**
You are to implement the two functions in this class.
You can add any other method or members to it as well.
However, you cannot change their signature.  
**/
class HW4{

public:
    int count(Node* r) const
    {
        if(r->next==NULL&&r->bro==NULL) { return 0;}
        if(r.isLeaf())
        {
            return ((1+count(r->next)+count(r->bro)));
        }
        count(r->next);
    }

    /*
    This method will return true if the tree rooted at node sn can answer
    the demand induced …
Run Code Online (Sandbox Code Playgroud)

c++ declaration

3
推荐指数
1
解决办法
628
查看次数

'[Class name]'没有在C++中命名一个类型

我正在使用列表列表编程图形.为此,我有两个类,这个类中的每一个都有一个指向同一个类的另一个对象的指针和一个指向第二个类的对象的指针.这是代码:

文件Vh:

#ifndef VERTICEPUNT_H
#define VERTICEPUNT_H

#include "A.cpp"

typedef char E;

 class V
{
    public:
    E etiqueta;
    V* siguiente;
    A* primera;  //<- Error: 'A' does not name a type

    V();
    ~V();
};

#endif // VERTICEPUNT_H
Run Code Online (Sandbox Code Playgroud)

文件V.cpp:

#include "V.h"

 V::V()
{
     etiqueta = ' ';
     siguiente = 0;
     primera = 0;  //<- Error: 'primera' was not declared in this scope
}

 V::~V()
{
    delete primera;
    delete siguiente;
}
Run Code Online (Sandbox Code Playgroud)

文件啊:

#ifndef ARISTAPUNT_H
#define ARISTAPUNT_H

#include "V.cpp"

typedef int P;

 class A
{ …
Run Code Online (Sandbox Code Playgroud)

compiler-errors class declaration

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

objective-c中的局部声明有什么区别

这些声明有什么区别,让我们称之为红色和橙色:优点,缺点?

红色和橙色的声明

declaration local objective-c ios

3
推荐指数
1
解决办法
288
查看次数

Python - 同时声明具有相同值的两个变量

a=[1,2,3]
b=[1,2,3]
Run Code Online (Sandbox Code Playgroud)

有没有办法在一条线上做到这一点?(显然不是用";")

a,b=[1,2,3] 
Run Code Online (Sandbox Code Playgroud)

不起作用因为

a,b,c=[1,2,3]
Run Code Online (Sandbox Code Playgroud)

a = 1 b = 2 c = 3

python declaration declare python-3.x

3
推荐指数
3
解决办法
4334
查看次数

C++,Class:成员错误的外线声明?

我正在尝试使用类创建动态数组.在我的头文件中,我有以下代码:

#ifndef DYNAMICARRAY
#define DYNAMICARRAY
#include <iostream>

class Array 
{

public:

    Array(); // Constructor - Initialises the data members
    ~Array(); // Destructor - That deletes the memory allocated to the array
    void addTings (float itemValue); // which adds new items to the end of the array
    float getTings (int index); // which returns the item at the index
    void size(); // which returns the number of items currently in the array

private:

    int arraySize;
    float  *floatPointer = nullptr;
};

#endif …
Run Code Online (Sandbox Code Playgroud)

c++ arrays compiler-errors class declaration

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

为什么这个类在VB.NET中有参数?

我搜索了很多,以了解这个类声明及其含义..但我甚至找不到这个叫做什么

Public MustInherent Class X ( Of TEntityBase, IBaseDataAccess As IBaseDataAccess ( Of TEntity)) 
     Implements IDisposable
.
.
.
Run Code Online (Sandbox Code Playgroud)

为什么这个类有参数?
他们叫什么?他们的意思是什么

注意:我来自Java世界.

vb.net oop class declaration

3
推荐指数
1
解决办法
54
查看次数

C++指针参照声明语法

令人难以置信的C++新手,并有一个(可能相当愚蠢)的问题:

我已经看到**在两种上下文中使用的运算符(我理解它是解除引用的解除引用):

char **arglist

char** arglist

语法之间是否存在有意义的差异,还是它们都完成了同样的事情?

c++ syntax pointers declaration operators

3
推荐指数
1
解决办法
109
查看次数