How to call function from class to main ?

How to call this 2 functions in main ?
If i have complex number (1+1i), moduo would be sqrt(2) and ~ would be 1-1i

1
2
3
  double Moduo () const
	{
	return sqrt(Re()*Re()+Im()*Im());


1
2
3
4
Kompleks operator ~() const
	{
	return Kompleks(Re() , -Im());
	}
Last edited on
You might need to show a bit more code. Assuming those are member functions of a class since Re() and Im() don't take in any arguments, you'd need to do something like

1
2
3
4
5
6
7
int main()
{
    Kompleks n(3, 4); // Constructor, makes 3 + 4i
    double m = n.Moduo();
    Kompleks n2 = ~n;
}
Topic archived. No new replies allowed.