可能重复:
在C++中模拟接口的首选方法
我很想知道C++中是否有接口,因为在Java中,设计模式的实现主要是通过接口将类解耦.有没有类似的方法在C++中创建接口呢?
我有Netbeans 6.9.1,我想将默认浏览器更改为Chrome.我已经看到一个针对Netbeans 6.5的线程,它可以配置Tools > Options > General
但问题是我在我的工具选项卡中找不到选项,因为我没有使用该版本.任何人都知道如何使用Netbeans 6.9.1做到这一点?
我知道当你final
在java中创建一个方法时,它无法被覆盖.
当一个方法是private
,它只能由该方法所在的给定类的方法和成员访问.
所以,这是否意味着因为无法访问该方法,所以尝试检查是否可以覆盖它是没有用的,因为我编写了以下声明并得到以下警告:
私有方法addCode声明为final
private final void addCode(String code)
{
//codes here...
}
Run Code Online (Sandbox Code Playgroud) 拜托,任何人都可以帮我解决这个问题:下面的代码片段工作正常,直到我决定添加一个滚动条以获得更好的视图,突然间,我得到错误:
"Multiple initializer values for default property, 'viewport' of type 'spark.core.IViewport'"
Run Code Online (Sandbox Code Playgroud)
谢谢
[CODE]
<s:Scroller
width="100%"
height="100%"
>
<s:Group id="basicDataGroup" includeIn="initial">
<s:HGroup id="buttonGroup"
x="250"
paddingTop="20"
gap="15">
<s:Button id="addBT" label="{resourceManager.getString('aggregationUI','add')}" click="addBT_clickHandler(event)"/>
<s:Button id="delBT" label="{resourceManager.getString('aggregationUI','delete')}"/>
</s:HGroup>
<s:DropDownList id="languageCombo"
prompt="{resourceManager.getString('aggregationUI','lang')}"
dataProvider="{new ArrayCollection([{locale:'fr_FI',label:'France'}, {locale:'en_US', label:'English'}])}"
change="languageChange(event)"
width="100"
x="473"
y="20"/>
<components:SearchComponent id="searchModel" searchClick="searchModel_searchClickHandler(event)"/>
<components:DataComponent id="basicData"
x="250"
y="50"/>
</s:Group>
<s:Group id="newModelGroup" includeIn="newModel">
<components:NewDataComponent id="newModelData"/>
</s:Group>
</s:Scroller>
[/CODE]
Run Code Online (Sandbox Code Playgroud) 在K&R书籍第104页,我发现了这句话:
Run Code Online (Sandbox Code Playgroud)char amessage[] = "now is the time"; //an array char *pmessage = "now is the time"; //a pointer
可以更改阵列中的各个字符,但
amessage
始终引用相同的存储.pmessage
随后可以将指针修改为指向其他位置,但如果您尝试修改字符串内容,结果将是未定义的...
那么,这是他们在两种情况下的错误吗?
对于阵列,
amessage[] = "allocate to another address"; //wrong?
Run Code Online (Sandbox Code Playgroud)
对于指针,
pmessage[0] = 'n'; //wrong?
Run Code Online (Sandbox Code Playgroud)
我只是想知道什么时候违反这些规则.
谢谢.
我有一个边框容器组件,其中包含一些其他组件.问题是当边框组件内的其他组件被调用时,会扩散出边界.有谁知道如何在边框周围添加滚动条,以便itz组件在其中?
<s:BorderContainer id="varGroup" includeIn="initial">
<s:Form width="151" height="154">
<s:layout>
<s:FormLayout gap="0" />
</s:layout>
<s:FormItem width="137" label="Name:" height="25">
<s:TextInput id="TnameTI" width="99"/>
</s:FormItem>
<s:FormItem width="137" label="condition:" height="25">
<s:TextInput id="TcondTI" width="99"/>
</s:FormItem>
</s:Form>
<components:NewModel x="0" y="61"/>
</s:BorderContainer>
Run Code Online (Sandbox Code Playgroud) 我有一个组标记,如下所示,但我收到错误:'标量值节点可能不是特定于州的'
<s:Group includeIn="newTask,branchingGroup,model_chain,model,condition">
<components:NewTask id="taskId" includeIn="newTask"/>
<components:NewBranchingGroup id="branchId" includeIn="branchingGroup"/>
<components:NewModelChain id="modelId" includeIn="model_chain" width="100%"/>
<components:Condition id="conditionId" includeIn="condition"/>
<s:Scroller>
<components:NewModel id="modelNId" includeIn="model" width="100%"/>
</s:Scroller>
</s:Group>
Run Code Online (Sandbox Code Playgroud)
实际上,由于尝试在最后一个组件标记周围添加滚动条组件,我收到了此错误.无论如何我能避免这个错误吗?
我有一个堆栈结构的头文件.我不明白的是这个错误让我感到困扰:
ISO C++禁止声明'Stack'没有类型
这是代码:
#include <stdexcept>
class Element;
class Stack{
public:
Stack():first(0){}; //constructor
~Stack(); //destructor
void push(int d);
int pop()throw(length_error);
bool empty();
private:
Element *first;
Stack(const& Stack){}; //copy constructor
Stack& operator = (const& Stack){}; //assignment operator..
};
Run Code Online (Sandbox Code Playgroud)
有没有人知道这个错误意味着什么?
我在Visual Studio中编写了一个简单的函数,以便能够研究如何在Visual Studio中编写C项目,但它给出了以下错误:
Error 1 error C2275: 'FILE' : illegal use of this type as an expression
c:\users\henry\documents\visual studio 2010\projects\exc4\exc4\measurement.c 25
1 Exc4
Error 2 error C2065: 'file' : undeclared identifier
c:\users\henry\documents\visual studio 2010\projects\exc4\exc4\measurement.c 25
1 Exc4
Error 3 error C2065: 'file' : undeclared identifier
c:\users\henry\documents\visual studio 2010\projects\exc4\exc4\measurement.c 31 1
Exc4
Error 6 error C2065: 'file' : undeclared identifier
c:\users\henry\documents\visual studio 2010\projects\exc4\exc4\measurement.c 39 1
Exc4
Error 9 error C2065: 'file' : undeclared identifier
c:\users\henry\documents\visual studio 2010\projects\exc4\exc4\measurement.c 41 1
Exc4
Error …
Run Code Online (Sandbox Code Playgroud) 如何向此代码添加事件,以便在拖动滑块时显示该数字.请让我知道,因为我是Java新手.
import javax.swing.*;
public class Slider extends JFrame {
JSlider pickNum = new JSlider(JSlider.HORIZONTAL, 0, 30, 5);
public Slider() {
super("Slider");
this.pack();
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
pickNum.setMajorTickSpacing(10);
pickNum.setMinorTickSpacing(1);
pickNum.setPaintTicks(true);
pickNum.setPaintLabels(true);
getPointedValue();
this.add(pickNum);
this.setVisible(true);
}
public final int getPointedValue() {
int value;
value = pickNum.getValue();
return value;
}
public static void main(String[] args) {
Slider frame = new Slider();
int i;
i = frame.getPointedValue();
System.out.println("current value is:" + i);
}
}
Run Code Online (Sandbox Code Playgroud) apache-flex ×3
flex4.5 ×3
c ×2
c++ ×2
java ×2
concept ×1
containers ×1
interface ×1
jslider ×1
netbeans-6.9 ×1
scroll ×1
swing ×1
syntax ×1