我想在JavaScript中使用面向对象编程技术但我无法从另一个类的一个类访问方法.怎么能这样呢?
class one{
write(){
console.log("Yes! I did!");
}
}
class two{
var object=new one();
tryingMethod(){
object.write();
}
}
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
未捕获的SyntaxError:意外的标识符 - >> for
var object=new one();
我的 C# 串口编程有问题,
我的目标是将 ByteArray 发送到串口,而不是作为 ByteArray。但我无法从串口获取。我试过:
string gelen = port.ReadExisting();
int asd = port.ReadByte();
string qwe = port.ReadLine();
Run Code Online (Sandbox Code Playgroud)
谁能告诉我出了什么问题?谢谢
我的代码:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO.Ports;
namespace serial_port_app
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
int text1, text2,text3,text4,text5, text6;
Int32.TryParse(textBox1.Text, out text1);
byte byteValue1 = Convert.ToByte(text1);
Int32.TryParse(textBox2.Text, out text2);
byte byteValue2 = Convert.ToByte(text2);
Int32.TryParse(textBox3.Text, …Run Code Online (Sandbox Code Playgroud)