Software Design
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreSoftware Design

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 1st, 2004, 09:19 PM
TheGreatBalshaj TheGreatBalshaj is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 39 TheGreatBalshaj User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
i'm a noob just started to learn programing

what do these lines mean:

double complex::realPart() const
{
return real;
}


complex operator+ (const complex& lhs,
const complex& rhs)
{
return complex(lhs.real+rhs.real, lhs.imag+rhs.imag);
}

Reply With Quote
  #2  
Old May 2nd, 2004, 03:01 AM
Lux Perpetua Lux Perpetua is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Feb 2004
Location: San Francisco Bay
Posts: 1,475 Lux Perpetua User rank is Major (30000 - 40000 Reputation Level)Lux Perpetua User rank is Major (30000 - 40000 Reputation Level)Lux Perpetua User rank is Major (30000 - 40000 Reputation Level)Lux Perpetua User rank is Major (30000 - 40000 Reputation Level)Lux Perpetua User rank is Major (30000 - 40000 Reputation Level)Lux Perpetua User rank is Major (30000 - 40000 Reputation Level)Lux Perpetua User rank is Major (30000 - 40000 Reputation Level)Lux Perpetua User rank is Major (30000 - 40000 Reputation Level)Lux Perpetua User rank is Major (30000 - 40000 Reputation Level)Lux Perpetua User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 3 Weeks 6 Days 21 m 14 sec
Reputation Power: 377
Quote:
Originally Posted by TheGreatBalshaj
what do these lines mean:

double complex::realPart() const
{
return real;
}
This defines a member function of the class "complex" that returns the real part of a complex number. For example, if "z" is an instance of class complex, then "z.realPart()" returns a double that presumably represents the real part of the complex number z. The "const" qualifier simply means that this function doesn't modify any part of the complex number it is called on (i.e., you can assume that the variable z is not changed by invoking "z.realPart()").
Quote:
Originally Posted by TheGreatBalshaj
complex operator+ (const complex& lhs,
const complex& rhs)
{
return complex(lhs.real+rhs.real, lhs.imag+rhs.imag);
}
This overloads the "+" operator so that you can add two complex numbers the same way you'd add two ints or two doubles. For example, if "a" and "b" are two instances of class complex, then you could add them by using "a + b" like you would for other arithmetic types.

Are there more specific things you don't understand?

Reply With Quote
  #3  
Old May 2nd, 2004, 05:27 PM
TheGreatBalshaj TheGreatBalshaj is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 39 TheGreatBalshaj User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
thank you for answearing me one more thing would help.
i've inserted my comments are they right?

complex operator* (const complex& lhs, const complex& rhs)
//overloading of complex multiplication
{
return complex(lhs.real*rhs.real - lhs.imag*rhs.imag,
lhs.real*rhs.imag+lhs.imag*rhs.real);

//complex multiplication is used to solve problem?
}

how far off am i with the comments? thanx again

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreSoftware Design > i'm a noob just started to learn programing


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT