Re: how do i create a class
Don't use #pragma once it is compiler specific. Here is what your H file might look like, keep in mind you will have to write the function implementation in the accompanying cpp file.
Originally posted by chanuajohnson
how do i create a class called Largest thatworks with only unsigned long values with the following methods(functions)
unsigned long value()const
i need help how to begin
to be included as my files
also how do i protect Largest.h from the mulitple inclusion with the #pragma once tag.
Use those #ifndef's for inclusion guards instead of #pragma once. Post back if you have more questions.
unsigned long m_foo;
unsigned long m_foo2;
Largest( ); // Constructor
~Largest( ); // Destructor
bool getNext( );
unsigned long value( ) const;
#endif /* LARGEST_H */
OOPS: To create an instance of this class in your main code, simply use the following syntax.
Where Largest is the class you want to create an instance of and MyLargeList is the variable name.