单项选择题

下列关于this指针的叙述中,正确的是( )。

A.任何与类相关的函数都有this指针
B.类的成员函数都有this指针
C.类的友元函数都有this指针
D.类的非静态成员函数才有this指针
<上一题 目录 下一题>
热门 试题

单项选择题
若有如下程序: #include <iostream> using namespace std; int s=0; class sample static int n; public: sample(int i) n=i; static void add() s+=n; ; int sample::n=0; int main() sample a(2),b(5); sample::add(); cout<<s<<endl; return 0; 程序运行后的输出结果是( )。
A.2
B.5
C.7
D.3
单项选择题
若有以下定义: char s[10]= program ,t[]= test ; 则下列选项中对字符串操作错误的是( )。
A.strcpy(s,t);
B.strcat(s,t);
C.cout<<strlen(s);
D.gets(s);
相关试题
  • 下面关于C++流的叙述中,正确的是( )。
  • 下面程序的输出结果是( )。 #include...
  • 有以下程序: #include <iostream> u...
  • 虚函数支持多态调用,一个基类的指针可以指...