当前位置:首页 科普知识 This(英语单词)

This(英语单词)

发布时间:2023-09-14 18:34:06

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

This(英语单词)介绍

This,英语单词,发音:。常翻译为:这,这么。

This(英语单词)

This例句

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.

这项工作必须继续下去。

This词语用法

adj.(形容词)this用作形容词作“这”解时,用于修饰表示在时间、地点、想法上更接近讲话者的事物或人,也可与包括现在的日子或一段时间的词语连用。

“this+one's+ n. ”是一种简洁的文体,有强调意味; “this+基数词+时间名词”表示一段时间。this可与of短语连用,后接名词性物主代词或名词所有格。

pron.(代词)this用作代词可用以指叙述中的人或事物,即指前面提到过的人或事物或下文提及的事物; this一般作主语时才指人; 在电话用语中, this用来指代自己。

当陈述部分的主语是this时,附加疑问部分的主语须用it。

This词汇搭配

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没有比他更好的人...

This计算机中

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

{

get { return array; }

set { array = 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

{

This(英语单词)

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;

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;

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(英语单词)

以下代码显示如何使用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()方法。

public class Main {  void m1() {    // Invoke the m2() method    this.m2(); // same as "m2();"  }  void m2() {    // do something  }}

ThisAS3.0

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

温馨提示:
本文【This(英语单词)】由作者 爱百科 转载提供。 该文观点仅代表作者本人, 自学教育网 信息发布平台,仅提供信息存储空间服务, 若存在侵权问题,请及时联系管理员或作者进行删除。
(c)2008-2025 自学教育网 All Rights Reserved 汕头市灵创科技有限公司
粤ICP备2024240640号-6