sekhar740
BAN USER- 0of 0 votes
AnswersQuestion on c++ templates...
- sekhar740 in India
template <class T>
T max(T a, T b)
{
return ( a > b )? a : b;
}
for built in data types it will work fine .. if we send class objects as parameters then how it will work??| Report Duplicate | Flag | PURGE
PayPal Software Engineer / Developer C++ - 0of 0 votes
Answersclass ex
- sekhar740 in India
{
int i;
public:
ex(int ii = 0):i(ii){}
~ex(){cout<<"dest"<<endl;}
void show()
{
cout<<"show fun called"<<endl;
}
};
int main(int argc , char *argv[])
{
ex *ob = NULL;
ob->show();
return 0;
}
what happens when we call show method.| Report Duplicate | Flag | PURGE
Salesforce Developer Program Engineer C++ - 0of 0 votes
AnswersHow to replace the space in the string with "ABC" without using extra memory.. string may contain some extra memory.
- sekhar740 in India
str = "i am chandu" -- str contation more memory...
str = "iABCamABCchandu"| Report Duplicate | Flag | PURGE
Salesforce Developer Program Engineer String Manipulation - 0of 0 votes
AnswersClass B
- sekhar740
{
Public:
Void disp();
Void show();
};
Class D : public B
{
Public:
Void disp();
Void show(D &);
};
int main()
{
B *b = new D();
b->disp();
b->show()//base clas show will be called
*/b->show(D)how call derive class show? */
}
how to call Derived class show function with base class pointer?| Report Duplicate | Flag | PURGE
Nisum Technologies C++ - 0of 0 votes
Answersclass Sample
- sekhar740
{
public:
Sample() { cout<<"const"<<endl; }
~Sample() {cout<<"destr"<<endl;delete this; }
};
int main()
{
Sample *obj = new Sample;
delete obj;
return 0;
}
what happens when u delete this in destructor?| Report Duplicate | Flag | PURGE
Nisum Technologies C++
Repethelsizer, SDET at ADP
I am Ethel , creative news writer with 5+ years of experience. Have great storytelling skills , wrote and delivered high quality ...
sry for first example output : 8765
- sekhar740 September 27, 2011