Posts
 
Reputation
Joined
Last Seen
0 Reputation Points
100% Quality Score
Upvotes Received
1
Posts with Upvotes
1
Upvoting Members
1
Downvotes Received
0
Posts with Downvotes
0
Downvoting Members
0
0 Endorsements
~3K People Reached
Favorite Forums
Favorite Tags
Member Avatar for mahesh113

Hi, Please tell me in the following question why no copy constructor is called when fun returns the A object. While returning b and constructing c, there is no copy constructor called. Why?? #include<iostream> using namespace std; class A { public: A(){cout <<"Default\n";} A(const A&){ cout<<"copy\n"; } A fun(A a) …

Member Avatar for mike_2000_17
0
336
Member Avatar for mahesh113

Hi All, Why the output of the following program is 0231?? Please resolve my doubt. #include <iostream> using namespace std; class B { int data; public: B() { data =0;} int func(){cout<<data++;return data++; } }; int main() { B b; cout<<b.func()<<b.func()<<endl; return 2; }

Member Avatar for rubberman
1
128
Member Avatar for mahesh113

Hi All, Pleas tell me why the following program is giving 35 as output?? if fun() returns int type then it is compilation error. why? #include<iostream> using namespace std; int &fun() { static int x = 10; return x; } int main() { fun() = 30; cout << fun(); return …

Member Avatar for Labdabeta
0
119
Member Avatar for mahesh113

Hi All Can somebody clear my query that why the second operand of '+' operator is called first in the code below? When operator '+' takes left to right. #include <iostream> using namespace std; class A { int i; public: A(int i=-1){cout<<"A const i = "<< i <<endl;} int operator+(const …

Member Avatar for rubberman
0
122
Member Avatar for mahesh113

Hi All, Could you please clear my doubt why this second catch block is called when exception is thrown only once. #include <iostream> using namespace std; class E { public: const char* error; E(const char* arg): error(arg) {} }; class B { public: B() {}; ~B(){cout<<"~B() called"<<endl;} }; class D: …

Member Avatar for deceptikon
0
346
Member Avatar for mahesh113

Hi all, Please answer this question. Why the output is ACA?? In the line obj = obj+6; the 6 should have been converted to obj type but, why it is converting the obj to int type? Please help... #include <iostream> using namespace std; class Base { public: Base(int m_var=1):i(m_var){ cout<<"A"; …

Member Avatar for Lucaci Andrew
0
152
Member Avatar for mahesh113

How come foo(3,3.14); Doesn't work but Goo(3,3.14); works? Please reply. #include <iostream> using namespace std; double foo(double a, double b) { cout<<"foo(double a, double b)"<<endl; } int foo(int a, int b){ cout<<"foo(int a, int b)"<<endl; } double Goo(float a, float b){ cout<<"Goo(float a, float b)"<<endl; } int Goo(int a, int …

Member Avatar for phorce
0
121
Member Avatar for mahesh113

How come the output of this program is 1413, I expected it to be 1414. (i + 1)->value() should have called R::value(). is n't it? #include<iostream> #include<vector> using namespace std; class Q { public: Q(int n = 0) : m_n(n) { } virtual int value() const { return m_n; } …

Member Avatar for Lucaci Andrew
0
166
Member Avatar for mahesh113

I want to learn multithreading in C++. somewhere on internet I got a piece of code using popen() function of stdio.h. I just wanted to know that if this function helps in creating the new threads or it doesn't come under multithreading. Please guide me in multithreading.

Member Avatar for L7Sqr
0
246
Member Avatar for harsha_123

I'm new to c++. I was studying data structures and came to know Linked Lists Lately. We had a problem of finding an item stored inside a linked list and here's the code I wrote using Visual Studio to store and find an item. This code gives me a run …

Member Avatar for harsha_123
0
1K
Member Avatar for mahesh113

Hi everyone, I am expert in C++ and want to be part of this discussion forum.

0
46