Sponsored Content
Top Forums Programming c++ object constructor question Post 302433480 by Corona688 on Tuesday 29th of June 2010 08:28:20 PM
Old 06-29-2010
I stand corrected, then. You still can't cast one parameter into two parameters, though. It could take a single class that had two members.

A better way to handle this case would be to overload function itself -- make another function of the same name that does in fact take two integers.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Constructor problem

Hi guys I am new to these forums but since I am taking a class at college I would appreciate any help that is possible for this program. My instructor said that when its complete the program should be able to store all 3 fields instead of just 1. public class Greeter2Test { public static... (4 Replies)
Discussion started by: woot4moo
4 Replies

2. Programming

why constructor cannot be virtual

helo i read many books but i cant find the proper answer that why constructor cannot be virtual can u explain me in simple term that why constructor cannot be virtual Regards, Amit (2 Replies)
Discussion started by: amitpansuria
2 Replies

3. Programming

how do you handle a constructor and destructor that fail

helo i m new in c++ on linux can u tell me with an simple example that how do you handle constructor and destructor that fail? Regards, Amit (4 Replies)
Discussion started by: amitpansuria
4 Replies

4. Programming

Doubt regarding Copy Constructor and return value

Hi All, I have made the simple following program :- #include <string> #include <iostream> using namespace std; class A{ private: int val; public : A(){cout<<"In A()"<<endl;} A (const A& aa) { cout<<"In copy c'tor"<<endl; } }; A f(... (1 Reply)
Discussion started by: shubhranshu
1 Replies

5. UNIX for Dummies Questions & Answers

Object reference not set to an instance of an object

I am new to PHP and UNIX. I am using Apache to do my testing on a Windows Vista machine. I am getting this error when I am trying to connect to a web service. I did a search and did not see any posts that pertain to this. Here is my function: <?php function TRECSend($a, $b, $c, $d,... (0 Replies)
Discussion started by: EddiRae
0 Replies

6. Programming

question about function object

I have a code as following: #include <iostream> #include <algorithm> #include <list> using namespace std; //the class Nth is a predicates class Nth{ private: int nth; int count; public: Nth(int n):nth(n),count(0){} bool operator()(int){ ... (2 Replies)
Discussion started by: homeboy
2 Replies

7. Programming

Shared Object Question

Hello, I am new to programming shared objects and I was hoping someone could tell me if what I want to do is possible, or else lead me in the right direction. I have a main program that contains an abstract base class. I also have a subclass that I'm compiling as a shared object. The subclass... (13 Replies)
Discussion started by: dorik
13 Replies

8. Programming

Doubts on C++ copy constructor concept

Hi, If I run the following program class A { public: A() { cout << "default" << endl; } A(const A&) { cout << "copy" << endl; } }; A tmp; A fun() { return tmp; } A test() { A tmp; cout << &tmp << endl; return tmp; } (1 Reply)
Discussion started by: royalibrahim
1 Replies

9. Programming

Constructor?

I am learning about C++ and today am reading concepts for Constructor but it seems a bit difficult to grab it fully. Please anyone explain in simple words about Constructor? (1 Reply)
Discussion started by: ggiwebsinfo
1 Replies

10. Programming

How to initialize an object with another object of different class?

How to initialize an object of class say "A", with an object of type say "B". The following code give the error message "error: conversion from âAâ to non-scalar type âBâ requested" #include <iostream> using namespace std; class B; class A{ public: A() { cout <<"\nA()" << endl; } ... (1 Reply)
Discussion started by: techmonk
1 Replies
Ops(3pm)						User Contributed Perl Documentation						  Ops(3pm)

NAME
PDL::Ops - Fundamental mathematical operators DESCRIPTION
This module provides the functions used by PDL to overload the basic mathematical operators ("+ - / *" etc.) and functions ("sin sqrt" etc.) It also includes the function "log10", which should be a perl function so that we can overload it! Matrix multiplication (the operator "x") is handled by the module PDL::Primitive. SYNOPSIS
none FUNCTIONS
plus Signature: (a(); b(); [o]c(); int swap) add two piddles $c = plus $a, $b, 0; # explicit call with trailing 0 $c = $a + $b; # overloaded call $a->inplace->plus($b,0); # modify $a inplace It can be made to work inplace with the "$a->inplace" syntax. This function is used to overload the binary "+" operator. Note that when calling this function explicitly you need to supply a third argument that should generally be zero (see first example). This restriction is expected to go away in future releases. plus does handle bad values. The state of the bad-value flag of the output piddles is unknown. mult Signature: (a(); b(); [o]c(); int swap) multiply two piddles $c = mult $a, $b, 0; # explicit call with trailing 0 $c = $a * $b; # overloaded call $a->inplace->mult($b,0); # modify $a inplace It can be made to work inplace with the "$a->inplace" syntax. This function is used to overload the binary "*" operator. Note that when calling this function explicitly you need to supply a third argument that should generally be zero (see first example). This restriction is expected to go away in future releases. mult does handle bad values. The state of the bad-value flag of the output piddles is unknown. minus Signature: (a(); b(); [o]c(); int swap) subtract two piddles $c = minus $a, $b, 0; # explicit call with trailing 0 $c = $a - $b; # overloaded call $a->inplace->minus($b,0); # modify $a inplace It can be made to work inplace with the "$a->inplace" syntax. This function is used to overload the binary "-" operator. Note that when calling this function explicitly you need to supply a third argument that should generally be zero (see first example). This restriction is expected to go away in future releases. minus does handle bad values. The state of the bad-value flag of the output piddles is unknown. divide Signature: (a(); b(); [o]c(); int swap) divide two piddles $c = divide $a, $b, 0; # explicit call with trailing 0 $c = $a / $b; # overloaded call $a->inplace->divide($b,0); # modify $a inplace It can be made to work inplace with the "$a->inplace" syntax. This function is used to overload the binary "/" operator. Note that when calling this function explicitly you need to supply a third argument that should generally be zero (see first example). This restriction is expected to go away in future releases. divide does handle bad values. The state of the bad-value flag of the output piddles is unknown. gt Signature: (a(); b(); [o]c(); int swap) the binary > (greater than) operation $c = gt $a, $b, 0; # explicit call with trailing 0 $c = $a > $b; # overloaded call $a->inplace->gt($b,0); # modify $a inplace It can be made to work inplace with the "$a->inplace" syntax. This function is used to overload the binary ">" operator. Note that when calling this function explicitly you need to supply a third argument that should generally be zero (see first example). This restriction is expected to go away in future releases. gt does handle bad values. The state of the bad-value flag of the output piddles is unknown. lt Signature: (a(); b(); [o]c(); int swap) the binary < (less than) operation $c = lt $a, $b, 0; # explicit call with trailing 0 $c = $a < $b; # overloaded call $a->inplace->lt($b,0); # modify $a inplace It can be made to work inplace with the "$a->inplace" syntax. This function is used to overload the binary "<" operator. Note that when calling this function explicitly you need to supply a third argument that should generally be zero (see first example). This restriction is expected to go away in future releases. lt does handle bad values. The state of the bad-value flag of the output piddles is unknown. le Signature: (a(); b(); [o]c(); int swap) the binary <= (less equal) operation $c = le $a, $b, 0; # explicit call with trailing 0 $c = $a <= $b; # overloaded call $a->inplace->le($b,0); # modify $a inplace It can be made to work inplace with the "$a->inplace" syntax. This function is used to overload the binary "<=" operator. Note that when calling this function explicitly you need to supply a third argument that should generally be zero (see first example). This restriction is expected to go away in future releases. le does handle bad values. The state of the bad-value flag of the output piddles is unknown. ge Signature: (a(); b(); [o]c(); int swap) the binary >= (greater equal) operation $c = ge $a, $b, 0; # explicit call with trailing 0 $c = $a >= $b; # overloaded call $a->inplace->ge($b,0); # modify $a inplace It can be made to work inplace with the "$a->inplace" syntax. This function is used to overload the binary ">=" operator. Note that when calling this function explicitly you need to supply a third argument that should generally be zero (see first example). This restriction is expected to go away in future releases. ge does handle bad values. The state of the bad-value flag of the output piddles is unknown. eq Signature: (a(); b(); [o]c(); int swap) binary equal to operation ("==") $c = eq $a, $b, 0; # explicit call with trailing 0 $c = $a == $b; # overloaded call $a->inplace->eq($b,0); # modify $a inplace It can be made to work inplace with the "$a->inplace" syntax. This function is used to overload the binary "==" operator. Note that when calling this function explicitly you need to supply a third argument that should generally be zero (see first example). This restriction is expected to go away in future releases. eq does handle bad values. The state of the bad-value flag of the output piddles is unknown. ne Signature: (a(); b(); [o]c(); int swap) binary not equal to operation ("!=") $c = ne $a, $b, 0; # explicit call with trailing 0 $c = $a != $b; # overloaded call $a->inplace->ne($b,0); # modify $a inplace It can be made to work inplace with the "$a->inplace" syntax. This function is used to overload the binary "!=" operator. Note that when calling this function explicitly you need to supply a third argument that should generally be zero (see first example). This restriction is expected to go away in future releases. ne does handle bad values. The state of the bad-value flag of the output piddles is unknown. shiftleft Signature: (a(); b(); [o]c(); int swap) leftshift "a$" by $b $c = shiftleft $a, $b, 0; # explicit call with trailing 0 $c = $a << $b; # overloaded call $a->inplace->shiftleft($b,0); # modify $a inplace It can be made to work inplace with the "$a->inplace" syntax. This function is used to overload the binary "<<" operator. Note that when calling this function explicitly you need to supply a third argument that should generally be zero (see first example). This restriction is expected to go away in future releases. shiftleft does handle bad values. The state of the bad-value flag of the output piddles is unknown. shiftright Signature: (a(); b(); [o]c(); int swap) leftshift "a$" by $b $c = shiftright $a, $b, 0; # explicit call with trailing 0 $c = $a >> $b; # overloaded call $a->inplace->shiftright($b,0); # modify $a inplace It can be made to work inplace with the "$a->inplace" syntax. This function is used to overload the binary ">>" operator. Note that when calling this function explicitly you need to supply a third argument that should generally be zero (see first example). This restriction is expected to go away in future releases. shiftright does handle bad values. The state of the bad-value flag of the output piddles is unknown. or2 Signature: (a(); b(); [o]c(); int swap) binary or of two piddles $c = or2 $a, $b, 0; # explicit call with trailing 0 $c = $a | $b; # overloaded call $a->inplace->or2($b,0); # modify $a inplace It can be made to work inplace with the "$a->inplace" syntax. This function is used to overload the binary "|" operator. Note that when calling this function explicitly you need to supply a third argument that should generally be zero (see first example). This restriction is expected to go away in future releases. or2 does handle bad values. The state of the bad-value flag of the output piddles is unknown. and2 Signature: (a(); b(); [o]c(); int swap) binary and of two piddles $c = and2 $a, $b, 0; # explicit call with trailing 0 $c = $a & $b; # overloaded call $a->inplace->and2($b,0); # modify $a inplace It can be made to work inplace with the "$a->inplace" syntax. This function is used to overload the binary "&" operator. Note that when calling this function explicitly you need to supply a third argument that should generally be zero (see first example). This restriction is expected to go away in future releases. and2 does handle bad values. The state of the bad-value flag of the output piddles is unknown. xor Signature: (a(); b(); [o]c(); int swap) binary exclusive or of two piddles $c = xor $a, $b, 0; # explicit call with trailing 0 $c = $a ^ $b; # overloaded call $a->inplace->xor($b,0); # modify $a inplace It can be made to work inplace with the "$a->inplace" syntax. This function is used to overload the binary "^" operator. Note that when calling this function explicitly you need to supply a third argument that should generally be zero (see first example). This restriction is expected to go away in future releases. xor does handle bad values. The state of the bad-value flag of the output piddles is unknown. bitnot Signature: (a(); [o]b()) unary bit negation $b = ~ $a; $a->inplace->bitnot; # modify $a inplace It can be made to work inplace with the "$a->inplace" syntax. This function is used to overload the unary "~" operator/function. bitnot does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. power Signature: (a(); b(); [o]c(); int swap) raise piddle $a to the power "b" $c = $a->power($b,0); # explicit function call $c = $a ** $b; # overloaded use $a->inplace->power($b,0); # modify $a inplace It can be made to work inplace with the "$a->inplace" syntax. This function is used to overload the binary "**" function. Note that when calling this function explicitly you need to supply a third argument that should generally be zero (see first example). This restriction is expected to go away in future releases. power does handle bad values. The state of the bad-value flag of the output piddles is unknown. atan2 Signature: (a(); b(); [o]c(); int swap) elementwise "atan2" of two piddles $c = $a->atan2($b,0); # explicit function call $c = atan2 $a, $b; # overloaded use $a->inplace->atan2($b,0); # modify $a inplace It can be made to work inplace with the "$a->inplace" syntax. This function is used to overload the binary "atan2" function. Note that when calling this function explicitly you need to supply a third argument that should generally be zero (see first example). This restriction is expected to go away in future releases. atan2 does handle bad values. The state of the bad-value flag of the output piddles is unknown. modulo Signature: (a(); b(); [o]c(); int swap) elementwise "modulo" operation $c = $a->modulo($b,0); # explicit function call $c = $a % $b; # overloaded use $a->inplace->modulo($b,0); # modify $a inplace It can be made to work inplace with the "$a->inplace" syntax. This function is used to overload the binary "%" function. Note that when calling this function explicitly you need to supply a third argument that should generally be zero (see first example). This restriction is expected to go away in future releases. modulo does handle bad values. The state of the bad-value flag of the output piddles is unknown. spaceship Signature: (a(); b(); [o]c(); int swap) elementwise "<=>" operation $c = $a->spaceship($b,0); # explicit function call $c = $a <=> $b; # overloaded use $a->inplace->spaceship($b,0); # modify $a inplace It can be made to work inplace with the "$a->inplace" syntax. This function is used to overload the binary "<=>" function. Note that when calling this function explicitly you need to supply a third argument that should generally be zero (see first example). This restriction is expected to go away in future releases. spaceship does handle bad values. The state of the bad-value flag of the output piddles is unknown. sqrt Signature: (a(); [o]b()) elementwise square root $b = sqrt $a; $a->inplace->sqrt; # modify $a inplace It can be made to work inplace with the "$a->inplace" syntax. This function is used to overload the unary "sqrt" operator/function. sqrt does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. abs Signature: (a(); [o]b()) elementwise absolute value $b = abs $a; $a->inplace->abs; # modify $a inplace It can be made to work inplace with the "$a->inplace" syntax. This function is used to overload the unary "abs" operator/function. abs does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. sin Signature: (a(); [o]b()) the sin function $b = sin $a; $a->inplace->sin; # modify $a inplace It can be made to work inplace with the "$a->inplace" syntax. This function is used to overload the unary "sin" operator/function. sin does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. cos Signature: (a(); [o]b()) the cos function $b = cos $a; $a->inplace->cos; # modify $a inplace It can be made to work inplace with the "$a->inplace" syntax. This function is used to overload the unary "cos" operator/function. cos does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. not Signature: (a(); [o]b()) the elementwise not operation $b = ! $a; $a->inplace->not; # modify $a inplace It can be made to work inplace with the "$a->inplace" syntax. This function is used to overload the unary "!" operator/function. not does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. exp Signature: (a(); [o]b()) the exponential function $b = exp $a; $a->inplace->exp; # modify $a inplace It can be made to work inplace with the "$a->inplace" syntax. This function is used to overload the unary "exp" operator/function. exp does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. log Signature: (a(); [o]b()) the natural logarithm $b = log $a; $a->inplace->log; # modify $a inplace It can be made to work inplace with the "$a->inplace" syntax. This function is used to overload the unary "log" operator/function. log does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. log10 Signature: (a(); [o]b()) the base 10 logarithm $b = log10 $a; $a->inplace->log10; # modify $a inplace It can be made to work inplace with the "$a->inplace" syntax. This function is used to overload the unary "log10" operator/function. log10 does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. assgn Signature: (a(); [o]b()) Plain numerical assignment. This is used to implement the ".=" operator assgn does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. AUTHOR
Tuomas J. Lukka (lukka@fas.harvard.edu), Karl Glazebrook (kgb@aaoepp.aao.gov.au), Doug Hunt (dhunt@ucar.edu), Christian Soeller (c.soeller@auckland.ac.nz), Doug Burke (burke@ifa.hawaii.edu), and Craig DeForest (deforest@boulder.swri.edu). perl v5.14.2 2012-05-30 Ops(3pm)
All times are GMT -4. The time now is 02:09 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy