C/C++问题。
1。怎么更好的学习MFC,MFC和C++的学习有关系吗?2。API对C++以及VC的学习有帮助吗?3。C++和VC可以同时学习吗?4。不学API,直接学习MFC有困难吗?...
1。怎么更好的学习MFC,MFC和C++的学习有关系吗?
2。API对C++以及VC的学习有帮助吗?
3。C++和VC可以同时学习吗?
4。不学API,直接学习MFC有困难吗? 展开
2。API对C++以及VC的学习有帮助吗?
3。C++和VC可以同时学习吗?
4。不学API,直接学习MFC有困难吗? 展开
5个回答
展开全部
MFC本来就是Windows的一个API,MFC使用C++的语法(本来就是C++的扩展),但是确确实实,完完全全不是C++。你学会了C++,MFC还是有很长的路要走。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
1、用心学就会学好,没关系
2、有
3、可以
4、有
2、有
3、可以
4、有
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
有关电脑方面的都有用!好好学吧!!!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Is C a subset of C++?
In the strict mathematical sense, C isn't a subset of C++. There are programs that are valid C but not valid C++ and even a few ways of writing code that has a different meaning in C and C++. However, C++ supports every programming technique supported by C. Every C program can be written in essentially the same way in C++ with the same run-time and space efficiency. It is not uncommon to be able to convert tens of thousands of lines of ANSI C to C-style C++ in a few hours. Thus, C++ is as much a superset of ANSI C as ANSI C is a superset of K&R C and much as ISO C++ is a superset of C++ as it existed in 1985.
Well written C tends to be legal C++ also. For example, every example in Kernighan & Ritchie: "The C Programming Language (2nd Edition)" is also a C++ program.
Examples of C/C++ compatibility problems:
int main()
{
double sq2 = sqrt(2); /* Not C++: call undeclared function */
int s = sizeof('a'); /* silent difference: 1 in C++ sizeof(int) in C */
}
Calling an undeclared function is poor style in C and illegal in C++. So is passing arguments to a function using a declaration that doesn't list argument types:
void f(); /* argument types not mentioned */
void g()
{
f(2); /* poor style C. Not C++ */
}
In C, a void* can be implicitly converted to any pointer type, and free-store allocation is typically done using malloc() which has no way of checking if "enough" memory is requested:
void* malloc(size_t);
void f(int n)
{
int* p = malloc(n*sizeof(char)); /* not C++. In C++, allocate using `new' */
char c;
void* pv = &c;
int* pi = pv; /* implicit conversion of void* to int*. Not in C++ */
}
Note the potential alignment error caused by the implicit conversion of the void* to a int*. See the C++ alternative to void* and malloc().
When converting from C to C++, beware that C++ has more keywords than C:
int class = 2; /* ok in C. Syntax error in C++ */
int virtual = 3; /* ok in C. Syntax error in C++ */
Except for a few examples such as the ones shown above (and listed in detail in the C++ standard and in Appendix B of The C++ Programming Language (3rd Edition)), C++ is a superset of C. (Appendix B is available for downloading).
Please note that "C" in the paragraphs above refers to Classic C and C89. C++ is not a descendant of C99; C++ and C99 are siblings. C99 introduces several novel opportunities for C/C++ incompatibilities.
--------------------------------------------------------------------------------
What is the difference between C and C++?
C++ is a direct descendant of C that retains almost all of C as a subset. C++ provides stronger type checking than C and directly supports a wider range of programming styles than C. C++ is "a better C" in the sense that it supports the styles of programming done using C with better type checking and more notational support (without loss of efficiency). In the same sense, ANSI C is a better C than K&R C. In addition, C++ supports data abstraction, object-oriented programming, and generic programming (see The C++ Programming Language (3rd Edition)"; Appendix B discussing compatibility issues is available for downloading).
I have never seen a program that could be expressed better in C than in C++ (and I don't think such a program could exist - every construct in C has an obvious C++ equivalent). However, there still exist a few environments where the support for C++ is so weak that there is an advantage to using C instead.
For a discussion of the design of C++ including a discussion of its relationship with C see The Design and Evolution of C++.
Please note that "C" in the paragraphs above refers to Classic C and C89. C++ is not a descendant of C99; C++ and C99 are siblings. C99 introduces several novel opportunities for C/C++ incompatibilities.
In the strict mathematical sense, C isn't a subset of C++. There are programs that are valid C but not valid C++ and even a few ways of writing code that has a different meaning in C and C++. However, C++ supports every programming technique supported by C. Every C program can be written in essentially the same way in C++ with the same run-time and space efficiency. It is not uncommon to be able to convert tens of thousands of lines of ANSI C to C-style C++ in a few hours. Thus, C++ is as much a superset of ANSI C as ANSI C is a superset of K&R C and much as ISO C++ is a superset of C++ as it existed in 1985.
Well written C tends to be legal C++ also. For example, every example in Kernighan & Ritchie: "The C Programming Language (2nd Edition)" is also a C++ program.
Examples of C/C++ compatibility problems:
int main()
{
double sq2 = sqrt(2); /* Not C++: call undeclared function */
int s = sizeof('a'); /* silent difference: 1 in C++ sizeof(int) in C */
}
Calling an undeclared function is poor style in C and illegal in C++. So is passing arguments to a function using a declaration that doesn't list argument types:
void f(); /* argument types not mentioned */
void g()
{
f(2); /* poor style C. Not C++ */
}
In C, a void* can be implicitly converted to any pointer type, and free-store allocation is typically done using malloc() which has no way of checking if "enough" memory is requested:
void* malloc(size_t);
void f(int n)
{
int* p = malloc(n*sizeof(char)); /* not C++. In C++, allocate using `new' */
char c;
void* pv = &c;
int* pi = pv; /* implicit conversion of void* to int*. Not in C++ */
}
Note the potential alignment error caused by the implicit conversion of the void* to a int*. See the C++ alternative to void* and malloc().
When converting from C to C++, beware that C++ has more keywords than C:
int class = 2; /* ok in C. Syntax error in C++ */
int virtual = 3; /* ok in C. Syntax error in C++ */
Except for a few examples such as the ones shown above (and listed in detail in the C++ standard and in Appendix B of The C++ Programming Language (3rd Edition)), C++ is a superset of C. (Appendix B is available for downloading).
Please note that "C" in the paragraphs above refers to Classic C and C89. C++ is not a descendant of C99; C++ and C99 are siblings. C99 introduces several novel opportunities for C/C++ incompatibilities.
--------------------------------------------------------------------------------
What is the difference between C and C++?
C++ is a direct descendant of C that retains almost all of C as a subset. C++ provides stronger type checking than C and directly supports a wider range of programming styles than C. C++ is "a better C" in the sense that it supports the styles of programming done using C with better type checking and more notational support (without loss of efficiency). In the same sense, ANSI C is a better C than K&R C. In addition, C++ supports data abstraction, object-oriented programming, and generic programming (see The C++ Programming Language (3rd Edition)"; Appendix B discussing compatibility issues is available for downloading).
I have never seen a program that could be expressed better in C than in C++ (and I don't think such a program could exist - every construct in C has an obvious C++ equivalent). However, there still exist a few environments where the support for C++ is so weak that there is an advantage to using C instead.
For a discussion of the design of C++ including a discussion of its relationship with C see The Design and Evolution of C++.
Please note that "C" in the paragraphs above refers to Classic C and C89. C++ is not a descendant of C99; C++ and C99 are siblings. C99 introduces several novel opportunities for C/C++ incompatibilities.
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询