107 Topics

Member Avatar for
Member Avatar for can-mohan

Hi All, In below code when class a object is assigned to class b by returning object through factory method i observed assignment is not happening properly and after assignment still class b's object points to NULL object only. *cobj=rhs;//it gives NULL object However below statement works perfectly when b …

Member Avatar for can-mohan
0
313
Member Avatar for can-mohan

Hi All, After compiling below code , I am getting below error. error: cannot convert a* to b* in assignment. it seems to be assignment doesn't work with pointers . Can anybody throw some light on this? i tried to use unique_ptr by transfering the ownership from a to b …

Member Avatar for can-mohan
0
335
Member Avatar for can-mohan

Hi All, in below class i wanted to have two friend function(overloading) one with default argument and other is without default argument. but during compilation it gives error. could you let me know how to fix (overload) this by not changing the function name , argument type or number of …

Member Avatar for rubberman
0
286
Member Avatar for jsefraijeen

i'm a newbie in java and i got an assignment to do and i don't know how to start ... the problem is: Write a program that will compute for the product of two numbers without using the * operator.. Sample Output: Enter Num1 :___ Enter num2 :___ Product is …

Member Avatar for JamesCherrill
0
9K
Member Avatar for VengefulToast

Hi, I have made a class and have an overloaded ostream operator method in it... However it tells me: "overloaded 'operator<<' must be a binary operator (has 3 parameters)." Can someone tell me how to fix this? Thank you! I have included some of my code: class Element { private: …

Member Avatar for Schol-R-LEA
0
461
Member Avatar for can-mohan

Hi Guys, In below code you can see that i am able to execute the functionality of class a , inside the class b through composition and object of b can be used to call the methods declared inside the a class. #include <iostream> using namespace std; class a { …

Member Avatar for can-mohan
0
423
Member Avatar for Niloofar24

Hello. I have a list like this: mylist = [7, "+", 2, "+", 1] I want to take them out of the list inorder to run the operation and get the real result; something like this: result = 7 + 2 + 1 So the result variable will be set …

Member Avatar for Niloofar24
0
332
Member Avatar for it@61@sec

I have the following struct definition: struct finfo { string filename; long fsize; bool operator() (finfo i, finfo j){return (i.fsize > j.fsize);} } fstruct; And the following vector definition: vector<finfo> fdata; In the code I use the following statement to sort the vector elements by fsize: sort(fdata.begin(),fdata.end(),fstruct); This works perfectly …

Member Avatar for it@61@sec
0
958
Member Avatar for Szabi Zsoldos

Hey guys, Having some difficulties understanding why my OR || operator is not working... First part is BOOLEAN and it is working Second part is STRING and it is working, it returns the desired value What could it be ? <?php if(($oferte->isOrdered($oferte->CleanSapStyleNumbers($oferta->VBELN)) == false) || ($oferte->OfertaValida($oferte->CleanSapStyleNumbers($oferta->VBELN))->valabilitate == "VALABILA")): ?> some …

Member Avatar for minitauros
0
203
Member Avatar for Cronicle8

Good morning, so I'm hoping anyone can help me, I'm planning this app, but I'm still searching if it's possible to be done or not. My question is the following: Imagine I'm in Spain, and I would like to get all the Network Operators in Spain. Is it possible to …

Member Avatar for Cronicle8
0
216
Member Avatar for Bendez Thyna

can someone explain me how this operator work? i just need some hit to clearify my confusion on this... thanks

Member Avatar for rubberman
0
168
Member Avatar for can-mohan

Hi, While executing below code i am getting error like "memory clobbered before allocated block" and due to this assignment is not happening. could you let me know what can be reason for the same. I do understand it is not good to use raw pointer but in current scenario …

Member Avatar for can-mohan
0
443
Member Avatar for StarBreezed

I'm writing a program that works with two sets of numbers put into arrays. The program uses overloaded + and - operators. Array one = 2 7 4 2 9 7 Array two = 2 9 8 9 1 10 12 The output should be: For +, New Array = …

Member Avatar for Ancient Dragon
0
342
Member Avatar for Elixir42

Dear Kind DaniWebbers, I am trying to overload the fstream operators (ofstream/ifstream), so that I can save a class to a 'Binary' file and also display it with cout. But the ways in which each need to be implemented is different. Please can you show me how to define different …

Member Avatar for vijayan121
0
4K
Member Avatar for Labdabeta

Hello, I have a particular set up of cast operators and constructors which is leading to a compile-time ambiguity error. I am wondering if somebody can explain why this is happening and what can be done to fix it. For example, here we have 2 classes: class A { int …

Member Avatar for Labdabeta
0
312
Member Avatar for jonathan710

#include <iostream> using namespace std; template<class T> class MyClass { private: T data; public: MyClass(T data) { this->data = data; } }; template<class T> bool operator< (const MyClass<T> & a, const MyClass<T> & b) { return (a.data < b.data); } int main() { MyClass<int> x(1); MyClass<int> y(2); if(x < y) …

Member Avatar for richieking
0
319
Member Avatar for can-mohan

Hi All, I have doubt in my mind regarding declaration of cin and cout object . As per my understanding cin and cout both object are accessible in main then they shouldn't have protected.in below code snippet i have overloaded both input and output operator and while giving new name …

Member Avatar for can-mohan
0
447
Member Avatar for prakash4

1. #include<stdio.h> #include<conio.h> int main() int a=10; printf("%d%d%d",a,a++,++a); getch(); return 0; } o/p:12 11 11 #include<stdio.h> #include<conio.h> int main() { double a=5.2; if(a==5.2) printf("equal"); else if(a<5.2) printf("less"); else printf("high"); getch(); } o/p: less Can any one give me explanation for the above outputs.....

Member Avatar for sepp2k
0
284
Member Avatar for DeadH34d

I've been reading through this introductory book on Python, and I've been following along fairly well. Compared to C++, Python seems to make more sense to me. That is, until I reached a section on Logical Operators. I don't completely understand what I just typed in to IDLE, and the …

Member Avatar for Gribouillis
0
406
Member Avatar for saurabh.mehta.33234

The foll code gives o/p as 2310103 28 Now my doubt is why here 10 is printed two times although i m passing t=6 for the d parameter?? #include <stdio.h> #include <string.h> int f(int a, int b, int c,int d,int e) { printf("%d%d%d%d%d \n",a,b,c,d,e); return a+b+c+d+e; } main() { int …

Member Avatar for Unimportant
-1
244
Member Avatar for yxBen

Hi, I've been learning about the std::copy function in the <algorithm> header and I'm stuck on this exercise that I gave my self. Let's see the code snippet first: #include <iostream> #include <vector> #include <algorithm> #include <iterator> using namespace std; ostream& operator<<(ostream& os, const int p_val) { os.put( p_val*2); return …

Member Avatar for yxBen
0
482
Member Avatar for nitin1

int m= i++ || ++j && k--; where i=2, j=3, amd k=5; acooridng to me, it will be executed left to right and then values of m=1, i=3, j=3 and k=5. but i have seen that precednace of && is more than || , than so how this expression is …

Member Avatar for Banfa
0
283
Member Avatar for sparkthesunoff

I have two containers with the type of *A* A<string, double> s1; A<string, bool> s2; So I wrote the *A* class with the necessary functions and I used a template<class T, class E> for it. It has a function that returns a value of *E*, in my case, it returns …

Member Avatar for sepp2k
0
270
Member Avatar for Anark10n

Pk, so here's the code I'm running for a checkboxlist object public void regSubjects(object sender, EventArgs e) { int courseCount = 0; for (int i = 0; i < coursesFound.Items.Count; i++) { if (coursesFound.Item[i].Selected) coursesCount++; } if ((courses < 4) && (courses > 6)) clabel.Text = string.Format("Choose between 4 - …

Member Avatar for rubberman
0
322
Member Avatar for rahulinfy

code part1: name1="rahul" name2="rahul" code part2: name1=[1,2,3] name2=[1,2,3] If I run the following code: print name1 is name2 I get "True" for code part1 and I get "False" for code part2 why? why the "reference" is same for name1 and name2 in "code part1" and different for name1 and name2 …

Member Avatar for snippsat
0
212
Member Avatar for tayyabatiq

I'm making a class for boolean expressions, a simpler version of bool. I need three operators, one for AND, one for OR and one for NOT. I can easily make **+** for OR, by overloading, but how can i declare **.** for AND and **'** for NOT? Can i even …

Member Avatar for Nutster
0
260
Member Avatar for bs111

I am just learning Xpath. How to mix 2 or more xpath validtions into a single line. On my page, I have 2 different tables under hthe //body tag. I want to validate two td s that exist on these 2 different tables. IsElementPresent is my own method. It uses …

Member Avatar for bs111
0
222
Member Avatar for Hey90

I have been told it is good to overload the stream extraction operator to load data from a file. Would I simple use this in my class: friend ifstream &operator>>( ifstream &input, Class &C ) { input >> C.variable1 >> C.variable2 >> C.variable3; return input; } What are the advantages …

Member Avatar for deceptikon
0
432
Member Avatar for darkeclipse8

---------------------------------------------TSet.h------------------------------------------------------ #include <iostream> using namespace std; template <class V> class TSet { public: TSet(); TSet(int size); ~TSet(); void add(V new_item); void remove(V item_to_remove); int num_of_items(); bool isFull(); bool is_item_in_set(V item); friend bool operator==(const TSet<V>& left, const TSet<V>& right); friend bool operator!=(const TSet<V>& left, const TSet<V>& right); friend ostream& operator<<(ostream& outs,const …

0
151
Member Avatar for aravind326

Hi, I am just trying to do some program on arithmetic expression parsing. So i want to store my operator precedence table in the program somehow. I could use a multidimensional array, but that would be inefficient i guess. Another idea i have is to use a HashTable, where the …

Member Avatar for aravind326
0
448

The End.