结构问题 [英] struct problem

查看:68
本文介绍了结构问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人请你这么好解释:

解决方案

有人请你这么好解释:

struct Vertex

{

Vertex(){}

顶点(float x,float y,float z,

float nx,float ny,float nz,float u,float v)

{

_x = x; _y = y; _z = z;

_nx = nx; _ny = ny; _nz = nz;

_u = u; _v = v;

}


float _x,_y,_z,_nx,_ny,_nz,_u,_v;


static const DWORD FVF;

};


这究竟是什么:?!?!?!

顶点(){}

顶点(浮点x,浮点数y,浮点数z,

浮点数nx,浮点数ny,浮点数nz,浮点数u,浮点数v)

{

_x = x; _y = y; _z = z;

_nx = nx; _ny = ny; _nz = nz;

_u = u; _v = v;

}


是vertex(){}函数吗?一个变量。有人至少可以给我一个名字

这里发生了什么,所以我知道该找什么?


欢呼

dave


文章< 3f ****** @ dnews.tpgi.com.au>,

Dave< da ********************************** @ hotmail.co m>写道:

有人请你这么好解释:
struct Vertex
{Vertex(){}
Vertex(float x,float y,float z,
float nx,float ny,float nz,float u,float v)
{
_x = x; _y = y; _z = z;
_nx = nx; _ny = ny; _nz = nz;
_u = u; _v = v;
}

浮_x,_y,_z,_nx,_ny,_nz,_u,_v;

静态const DWORD FVF;
};
[snip]是vertex(){}一个函数?




这是一个不带参数/参数的构造函数,什么都不做。 />
它允许你声明一个Vertex类型的变量,而不指定数据的

值:


Vertex thisVertex;


在这种情况下,所有数据成员都是默认初始化的。在这种情况下,

数据成员都是浮点数,因此它们根本没有初始化,并且
包含发生在这些内存位置的任何位模式。 />

如果你根本没有定义构造函数,编译器会自动为你生成这样一个

的默认构造函数。但是,如果您定义了自己的任何

构造函数(如此处所示),则必须定义

默认构造函数(如果需要)。 />

-

Jon Bell< jt ******* @ presby.edu> Presbyterian College

美国南卡罗来纳州克林顿物理与计算机科学系


Vertex(){}是默认构造函数。每次声明没有默认参数的物体时,都会调用它。


例如,

Vertex v1; \\ Vertex()被称为

Vertex v2(0,0,0,0,0,0,0,0); \\第二个Vertex构造函数被调用。


丹佛。


" Dave" < da ********************************** @ hotmail.co m>在留言中写道

新闻:3f ****** @ dnews.tpgi.com.au ...

有人请你这么好解释:
struct Vertex
{Vertex(){}
Vertex(float x,float y,float z,
float nx,float ny,float nz,float u,漂浮v)
{
_x = x; _y = y; _z = z;
_nx = nx; _ny = ny; _nz = nz;
_u = u; _v = v;
}

浮_x,_y,_z,_nx,_ny,_nz,_u,_v;

静态const DWORD FVF;

Vertex(){}
Vertex(float x,float y,float z ,
浮动nx,浮动ny,浮动nz,浮动u,浮动v)
{
_x = x; _y = y; _z = z;
_nx = nx; _ny = ny; _nz = nz;
_u = u; _v = v;
}

是一个函数?vertex(){}一个变量。有人至少可以给我一个
的名字,告诉我这里发生了什么,所以我知道该找什么?

欢呼
dave


would someone please be so kind as to explain:

解决方案

would someone please be so kind as to explain:
struct Vertex
{
Vertex(){}
Vertex(float x, float y, float z,
float nx, float ny, float nz, float u, float v)
{
_x = x; _y = y; _z = z;
_nx = nx; _ny = ny; _nz = nz;
_u = u; _v = v;
}

float _x, _y, _z, _nx, _ny, _nz, _u, _v;

static const DWORD FVF;
};

what on earth is this:?!?!?!

Vertex(){}
Vertex(float x, float y, float z,
float nx, float ny, float nz, float u, float v)
{
_x = x; _y = y; _z = z;
_nx = nx; _ny = ny; _nz = nz;
_u = u; _v = v;
}

is vertex(){} a function? a variable. Could someone at least give me a name
as to what''s going on here so i know what to look for?

cheers
dave


In article <3f******@dnews.tpgi.com.au>,
Dave <da**********************************@hotmail.co m> wrote:

would someone please be so kind as to explain:
struct Vertex
{
Vertex(){}
Vertex(float x, float y, float z,
float nx, float ny, float nz, float u, float v)
{
_x = x; _y = y; _z = z;
_nx = nx; _ny = ny; _nz = nz;
_u = u; _v = v;
}

float _x, _y, _z, _nx, _ny, _nz, _u, _v;

static const DWORD FVF;
}; [snip]is vertex(){} a function?



It''s a constructor that takes no arguments/parameters, and does nothing.
It allows you to declare a variable of type Vertex without specifying
values for the data:

Vertex thisVertex;

in which case all the data members are default-initialized. In this case,
the data members are all floats, so they are not initialized at all and
contain whatever bit-patterns happened to be in those memory locations.

If you define no constructors at all, the compiler generates such a
default constructor for you automatically. However, if you define any
constructors of your own (as is the case here), you must define the
default constructor, too, if you want one.

--
Jon Bell <jt*******@presby.edu> Presbyterian College
Dept. of Physics and Computer Science Clinton, South Carolina USA


Vertex(){} is the default constructor. It is called every time an object of
Vertex is declared with no default parameters.

e.g.,
Vertex v1; \\ Vertex() is called
Vertex v2(0,0,0,0,0,0,0,0); \\ the second Vertex constructor is called.

Denver.

"Dave" <da**********************************@hotmail.co m> wrote in message
news:3f******@dnews.tpgi.com.au...

would someone please be so kind as to explain:
struct Vertex
{
Vertex(){}
Vertex(float x, float y, float z,
float nx, float ny, float nz, float u, float v)
{
_x = x; _y = y; _z = z;
_nx = nx; _ny = ny; _nz = nz;
_u = u; _v = v;
}

float _x, _y, _z, _nx, _ny, _nz, _u, _v;

static const DWORD FVF;
};

what on earth is this:?!?!?!

Vertex(){}
Vertex(float x, float y, float z,
float nx, float ny, float nz, float u, float v)
{
_x = x; _y = y; _z = z;
_nx = nx; _ny = ny; _nz = nz;
_u = u; _v = v;
}

is vertex(){} a function? a variable. Could someone at least give me a name as to what''s going on here so i know what to look for?

cheers
dave



这篇关于结构问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆