consolidate all repos to one for archive
This commit is contained in:
35
semester_2/programiranje_2/primeri/Example05/Complex.h
Normal file
35
semester_2/programiranje_2/primeri/Example05/Complex.h
Normal file
@@ -0,0 +1,35 @@
|
||||
|
||||
#ifndef EXAMPLE05_COMPLEX_H
|
||||
#define EXAMPLE05_COMPLEX_H
|
||||
|
||||
class Complex {
|
||||
private:
|
||||
double real, imag;
|
||||
static int counter; // class variable
|
||||
//static const int counter1; // constant class variable
|
||||
public:
|
||||
Complex(); // default constructor
|
||||
Complex(double r, double i = 0); // conversion constructor
|
||||
Complex(const Complex& c); // copy constructor
|
||||
~Complex(); // destructor
|
||||
void print() const;
|
||||
Complex plus(const Complex& c) const;
|
||||
|
||||
//static int getCounter();
|
||||
|
||||
static int getCounter() { // class method
|
||||
return counter;
|
||||
//return real; // ERROR
|
||||
//return counter++; // OK
|
||||
//return this->counter; // ERROR
|
||||
}
|
||||
/*
|
||||
//static int getCounter1() const { // const is not allowed for class methods
|
||||
static int getCounter1() { // class method
|
||||
return counter1;
|
||||
//return counter1++;
|
||||
}
|
||||
*/
|
||||
};
|
||||
|
||||
#endif //EXAMPLE05_COMPLEX_H
|
||||
Reference in New Issue
Block a user