新闻资讯
看你所看,想你所想

This(英语单词)

This(英语单词)

This(英语单词)

This,英语单词,发音:[英][ðɪs][美][ðɪs]。常翻译为:这,这幺。

基本介绍

  • 外文名:This
  • 属性:英语单词
  • 其他:烟名
  • 翻译:这, 本,这幺
  • java:关键字

例句

This ship docked this morning.
这条船是今天早上靠的码头。
.This new approach is
新方案有:
.A downpour this afternoon
下午有瓢泼大雨
.For this particular purpose
为某一特别目的
.Move this heavy box
把这重箱子挪动
Pecified by doing this
将某物挤成某形状、大小等
Person who does this
(使人感到)忧愁的,沮丧的
.Shop operating this system
现款自运商店(实行上述制度的商店)
.Wish this delay tolerate
望原谅我的延误。
.This work continues. This story goes on.
这项工作必须继续下去。

词语用法

adj.(形容词)this用作形容词作“这”解时,用于修饰表示在时间、地点、想法上更接近讲话者的事物或人,也可与包括现在的日子或一段时间的词语连用。
“this+one's+ n. ”是一种简洁的文体,有强调意味; “this+基数词+时间名词”表示一段时间。this可与of短语连用,后接名词性物主代词或名词所有格。
pron.(代词)this用作代词可用以指叙述中的人或事物,即指前面提到过的人或事物或下文提及的事物; this一般作主语时才指人; 在电话用语中, this用来指代自己。
当陈述部分的主语是this时,附加疑问部分的主语须用it。

辞彙搭配

in this day and age当今
this and that 又是这个
... ... to this day至今
at this rate照这样下去
this day week上星期的今天
... with this这样说了就
in this regard在这点上
this here这, 这个
this day month一个月前的今天,一个
... at this moment in time现在
all this while这一阵子
This is just between you and me.这只是我们两个之间的
... selfsame完全一样的
by this这时
this instant即刻
by this time到这时
like this象这样
this much是这样(这幺多
... from this day forth从今天起
a better man never trod this earth没有比他更好的人...

计算机中

C#中的this
C#中的保留字this仅限于在构造函式,类的方法和类的实例中使用。
* 在类的构造函式中出现的this作为一个值类型,它表示对正在构造的对象本身的引用
* 在类的方法中出现的this作为一个值类型,表示对调用该方法的对象的引用
* 在结构的构造函式中出现的this作为一个变数类型,表示对正在构造的结构的引用
* 在结构的方法中出现this作为一个变数类型,表示对调用该方法的结构的引用
* 被用来区分类成员及本地的成员
* 除此之外,其他地方使用this保留字都是不合法的。
一.this的常用用途:
1.限定被相似的名称隐藏的成员
eg:public Employee(string name, string alias)
{
this.name= name;
this.alias = alias;
}
2.将对象作为参数传递到其他方法
eg:CalcTax(this);
3.声明索引器
eg:public int this [int param]
{
get { return array[param]; }
set { array[param] = value; }
}
二.典型示例
在本例中,this 用于限定 Employee 类成员 name 和 alias,它们都被相似的名称隐藏。this 还用于将对象传递到属于其他类的方法 CalcTax。
// keywords_this.cs
// this example
using System;
class Employee
{
private string name;
private string alias;
private decimal salary = 3000.00m;
// Constructor:
public Employee(string name, string alias)
{
// Use this to qualify the fields, name and alias:
this.name= name;
this.alias = alias;
}
// Printing method:
public void printEmployee()
{
Console.WriteLine("Name: {0}\nAlias: {1}", name, alias);
// Passing the object to the CalcTax method by using this:
Console.WriteLine("Taxes: {0:C}", Tax.CalcTax(this));
}
public decimal Salary
{
get { return salary; }
}
}
class Tax
{
public static decimal CalcTax(Employee E)
{
return 0.08m * E.Salary;
}
}
class MainClass
{
static void Main()
{
// Create objects:
Employee E1 = new Employee("John M. Trainer", "jtrainer");
// Display results:
E1.printEmployee();
}
}
输出:
Name: John M. Trainer
Alias: jtrainer
Taxes: $240.00
C++中的this
this是关键字,属于实体(entity),是一个指针右值,只能在class,struct, 和union类型中的非静态成员函式/函式模版class指针访问,指向被调成员所属的对象。静态成员中无法使用this指针。
this
this->member-identifier
一.备注:
1.一个对象的this指针并不是这个对象自身的一部分;当一个非静态成员函式调用一个对象时,对象的地址就以隐藏参数的形式通过编译器传递给了函式。
eg:
myDate.setMonth(3);
也可以这样表达:
setMonth(&myDate,3);
2.对象的地址可以通过this指针在成员函式中传递。指称非静态成员时,大多数情况下可以隐含this,这是合法的。儘管不必要,但在访问class的成员时显式使用this->或(*this).有助于避免存在和成员同名的参数时的误用。此外,继承的基类若依赖于模版类型参数,访问其中的成员必须显式使用this以在实例化后指定适当的成员,否则名称查找并不会在依赖类型中查找成员。
eg:
void Date::setMonth( int mn )
{
month = mn; // These three statements
this->month = mn; // are equivalent
(*this).month = mn;
}
3.*this这种表达形式通常是用来在成员函式中返回当前对象。
eg:
return *this;
4.this指针有时候也用来防止自我引用。
eg:
if (&Object != this) {
// do not execute in cases of self-reference
}
二.典型示例
// this_pointer.cpp
// VC++: compile with: /EHsc
#include <iostream>
#include <cstring>
using namespace std;
class Buf
{
public:
Buf( char* szBuffer,size_tsizeOfBuffer );
Buf& operator=( const Buf & );
void Display() { cout << buffer << endl; }
private:
char* buffer;
size_tsizeOfBuffer;
};
Buf::Buf( char* szBuffer,size_tsizeOfBuffer )
{
sizeOfBuffer++; // account for a NULL terminator
buffer = new char[ sizeOfBuffer ];
if (buffer)
{
strcpy_s( buffer, sizeOfBuffer, szBuffer );
sizeOfBuffer = sizeOfBuffer;
}
}
Buf& Buf::operator=( const Buf &otherbuf )
{
if( &otherbuf !=this)
{
if (buffer)
delete [] buffer;
sizeOfBuffer = strlen( otherbuf.buffer ) + 1;
buffer = new char[sizeOfBuffer];
strcpy_s( buffer, sizeOfBuffer, otherbuf.buffer );
}
return*this;
}
int main()
{
Buf myBuf( "my buffer", 10 );
Buf yourBuf( "your buffer", 12 );
// Display 'my buffer'
myBuf.Display();
// assignment opperator
myBuf = yourBuf;
// Display 'your buffer'
myBuf.Display();
}
输出:
my buffer
your buffer
Java中的this
Java中的this关键字是对类的当前实例的引用,它只能在实例的上下文中使用。
以下代码显示如何使用this关键字:
public class Main {  int varA = 1;  int varB = varA; // Assign value of varA to varB  int varC = this.varA; // Assign value of varA to varC}例子:下面的代码显示了如何使用this关键字来引用一个实例变数,它的名字被一个局部变数隐藏。public class Main {  int num = 2014; // An instance variable  void printNum(int num) {    System.out.println("Parameter num: " + num);    System.out.println("Instance variable num: " + this.num);  }  public static void main(String[] args) {    Main tt6 = new Main();    tt6.printNum(2000);  }}上面的代码生成以下结果:
我们可以使用关键字this来限定实例方法名称。以下代码显示使用关键字this调用m2()方法的m1()方法。
This(英语单词)
public class Main {  void m1() {    // Invoke the m2() method    this.m2(); // same as "m2();"  }  void m2() {    // do something  }}

AS3.0

this在一个类里面是指代类‘自己’,通过这个指向,可以访问类内部的属性、方法(在外部只能访问公用的)。this,在帧代码里,指向舞台,可以访问舞台的元素。

转载请注明出处海之美文 » This(英语单词)

相关推荐

    声明:此文信息来源于网络,登载此文只为提供信息参考,并不用于任何商业目的。如有侵权,请及时联系我们:ailianmeng11@163.com