Whats function of this class?

It is for static page, dynamic page, website, SEO, performance and other web development discussion
ramverma
Posts: 435
Joined: Sat Aug 23, 2014 5:34 pm
Contact:

Whats function of this class?

Postby ramverma » Wed Oct 21, 2015 4:21 pm

While reading some tutorial on template, i stumbled upon a class which was used as a float later while declaring template class object, but couldn't understand why its needed, if any one could explain.

class Number {
float f;
public:
Number(float ff = 0.0f) : f(ff) {}
Number& operator=(const Number& n) {
f = n.f;
return *this;
}
operator float() const { return f; }
friend ostream&
operator<<(ostream& os, const Number& x) {
return os << x.f;
}
};


Return to “PHP, HTML, MYSQL and Web Hosting”

Who is online

Users browsing this forum: No registered users and 2 guests