当我们从类或结构中创建指针时,这意味着什么? [英] When we make a pointer from a class or structure , what is that mean?

查看:104
本文介绍了当我们从类或结构中创建指针时,这意味着什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好b $ b

我想知道这些声明的意思是什么?



Hi
I want to know what is the mean of these declarations?

Structure struct (); 
struct* s1 ;

OR

Class class1();
class1* c1;





在s1或c1中分配哪些东西?

一般来说,当我们从类或结构中声明一个会发生什么事情的指针时,我想知道!





最后,c ++中的迭代器是什么?

我看到这段代码,我不明白这是什么意思?





Which thing will allocated in s1 or c1 ?
Generally when we declare a pointer from a class or structure what thing will happen , I want to know !


And finally , what is the iterator in c++ ?
I saw this code and I couldn''t understand what is that mean?

std::vector<cv::Vec3f>::iterator itrCircles;
QString::number((*itrCircles)[0]).rightJustified(4 , ' ')







非常感谢!




Thanks a lot !

推荐答案

参见 here [ ^ ]了解C ++语言的完整细节。
See here[^] for full details of the C++ language.


这些都不是合法的C或C ++语法。



首先,你甚至没有使用正确的关键词。 C / C ++中的关键字和符号区分大小写。



其次,您的语法是关闭的:您没有为您的语句按正确的顺序排列关键字和符号理解。



三,声明 struct class 使用花括号 {} 封装其内容,而不是圆括号()



第四,指针不是自己分配的。他们就像路标指向远处的某些东西,所以你可以找到它。但这并不意味着标志创造了那个东西,



第五,让你如此困惑的代码片段与之前完全不同的理解水平你首先不了解的事情。即使试图解释这一点也没有意义。



说真的:一位优秀的导师只教你,就个人而言,也许可以向你解释这个片段,直到你真的明白了比如,一周。如果您是一位经验丰富的程序员(有其他计算机语言经验),那么两天就足够了。请理解我们无法在此提供这种级别的个人辅导。



我建议您按照理查德在解决方案1中提供的链接,或使用任何其他C ++参考或预订您喜欢,并且首先学习基础知识。



或者,如果您有理由需要了解该代码片段,也许您应该向我们解释这个原因,所以我们可能会帮助您解决问题背后的真正问题。
None of this is legal C or C++ syntax.

First of all, you''re not even using the correct keywords. Keywords and symbols in C/C++ are case sensitive.

Second, your syntax is off: you didn''t put the keywords and symbols in correct order for your statements to make sense.

Third, declarations of a struct or class use curly braces {} to enclose their contents, not rounded braces () .

Fourth, pointers do not allocate by themselves. They''re like road signs pointing to some thing in the distance so you can find it. That doesn''t mean the sign created that thing however,

Fifth, the code snippet that confused you so much is at an entirely different level of understanding than the previous things you didn''t understand in the first place. There is no point in even trying to explain that.

Seriously: a good tutor teaching only you, personally, might be able to explain that snippet to you to the point that you really understand it in, say, a week. If you were an experienced programmer (experienced in other computer languages that is), maybe two days would be enough. Please understand we cannot provide that level of personal tutoring here.

I suggest you follow the link Richard provided in solution 1, or use any other C++ reference or book that you like, and first learn the basics.

Or, if there is a reason you need to understand that code snippet, maybe you should explain that reason to us, so we might help you solve the real issue behind your question.


这篇关于当我们从类或结构中创建指针时,这意味着什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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