45 Topics

Member Avatar for
Member Avatar for vavazoom

I have a Matrix class and I am trying to overload the multiplication sign. It compiles without error and runs, however it does not display the matrix like it should. So I want to make sure the error is not in my overload operation. [CODE] public static Matrix operator *(Matrix …

Member Avatar for ddanbe
0
176
Member Avatar for arthurav

I have the following program : [CODE] #include<iostream> #include<string> #include<conio.h> using namespace std; template <class T> class matrice { T **a; int m,n; public: matrice(); matrice(int,int,int); matrice(char *); matrice(int,int,T **); matrice(matrice &x); ~matrice(){}; template <class U> friend ostream &operator <<(ostream &,matrice<U> &); int getNrLinii(){ return m; } int getNrColoane(){ return …

Member Avatar for Fbody
0
187
Member Avatar for arthurav

I am creating a template class for working with matrices and get an error when I try to use the overloaded << operator. This is the code: [CODE]#include<iostream> #include<string> #include<conio.h> using namespace std; template <class T> class matrice { T **a; int m,n; public: matrice(); matrice(int,int); matrice(FILE *); matrice(int,int,T **); …

Member Avatar for vijayan121
0
2K
Member Avatar for DJSAN10

If the main() takes 3 arguments i.e. int argc,char * argv[],char *env[] and SINCE C DOES NOT SUPPORT FUNCTION OVERLOADING ,y does the c compiler does not give error for simply void main() //that is no arguments at all OR void main(int argc,char *argv[]) //2 arguments

Member Avatar for DJSAN10
0
192
Member Avatar for harryhaaren

Hey guys, I written a base class (AudioTrackElement), and derived a class from there (Looper) and another (VolumePan). The looper class implements functionality, while the AudioTrackElement is there just so I can hold many Loopers and VolumePan objects in the same vector. The problem: I can create a [icode]std::vector<AudioTrackElement>[/icode] no …

Member Avatar for harryhaaren
0
226
Member Avatar for abuka

I've got this header and cpp.And I would like to insert this operator overloading to this .h and .cpp file. but I always got errors. Operator OVERLOADING : [CODE]istream& operator>>(istream& in, Focista& jatekos) { cout << "Add meg a focista tulajdonsagait. " << endl; cout << "Nev: " << endl; …

Member Avatar for abuka
0
233
Member Avatar for aviavyne

Hello, I have a problem which goes like this. I need to be able to design a simple class, which i have done, and it must represent any numeric value, which includes a decimal and negative value. So i need to overload the operators, because the '%' will make an …

Member Avatar for Clinton Portis
0
252
Member Avatar for lasl0w

Hey all, I'm doing a project to create an address book which uses a binary search tree (AVL node) structure to store, search and sort the data. There are 14 main fields for each address contact. All fields can be represented as strings. The 14th field can have unlimited entries. …

Member Avatar for mike_2000_17
0
196
Member Avatar for brandonrunyon

I have a class "Homework" that has a private attribute "int time" and I have set up a + operator to add the times of two Object instances. I have also created a Template "sum(T a, T b)" that takes two arguments and adds them together. I'm having difficulty using …

Member Avatar for brandonrunyon
0
255
Member Avatar for ana_1234

myint.h [CODE]#include <iostream> // so that we can overload << and >> using namespace std; class MyInt { // these overload starters are declared as friend functions friend MyInt operator+(const MyInt& f1, const MyInt& f2); //friend MyInt operator*(const MyInt& f1, const MyInt& f2); /*friend MyInt operator++(MyInt& f1, int); // postfix …

Member Avatar for ana_1234
0
392
Member Avatar for ana_1234

This is a friend operator overload function that used addition. It adds two mix fraction by reducing them to simplest form the adding and converting them back to a mixed number [CODE]Mixed operator+(const Mixed& f1, const Mixed& f2) { int newnum, newnum2, gcd, tmpNumerator2, tmpNumerator, tmpInteger, tmpInteger2; Mixed r; tmpNumerator …

Member Avatar for ana_1234
0
418
Member Avatar for ana_1234

So I've been working on this program for a while, I'm finally finish but I have two error that I can not understand why. My first error is when I am declaring the header f [CODE] //------------------- Mixed.cpp -------------- #include <iostream> #include "mixed.h" using namespace std;[/CODE]ile> it keep sending me …

Member Avatar for ana_1234
0
289
Member Avatar for Sinaru

I have two classes and one of them is inherited from the other class. Class Person - used to store first name and last name of a person. The data members are protected. Class Candidate - used to store votes of an election, and this is inherited from Person class …

Member Avatar for arkoenig
0
160
Member Avatar for saransh60

#include<iostream> using namespace std; class alpha{ private: int data; public: alpha(){} alpha(int a){data=a;} void display(){ cout<<data; } alpha operator =(alpha& a){ cout<<data; data=a.data; cout<<"\n assignement operator invoked"; return alpha(data); // is temporary object created is returned to a2 object ?//why it can't be returned by reference?what is the difference b/w …

Member Avatar for Narue
0
113
Member Avatar for y2kshane

can i declare operator overloading function as a friend function? i did it and i get errors #include <iostream.h> class time { int h; int m; friend time operator +(time); public: void input(); time(); time(int,int); void display(); }; time::time() { h=0; m=0; } time::time(int a,int b) { h=a; m=b; } …

Member Avatar for Stefano Mtangoo
0
292

The End.