Objectives :
- Introducing class,
using Qunicy 2005 compiler and
win 2000
professional.
- strcpy, wcscpy, _mbscpy
- Copy a string.
- char *strcpy( char *strDestination, const char *strSource
);
- wchar_t *wcscpy( wchar_t *strDestination, const wchar_t
*strSource );
- unsigned char *_mbscpy( unsigned char *strDestination,
const unsigned char
*strSource );
- Routine Required Header Compatibility
strcpy <string.h> ANSI, Win 95, Win NT
wcscpy <string.h> or <wchar.h> ANSI, Win 95, Win NT
_mbscpy <mbstring.h> Win 95, Win NT
- Defining a Class
- ·
Access Modifiers : Public or Private or Protected
class name // needs keyword class and identifier like "Name"
// for sanity the class name should start with capital letter
// although C++ will not object to "Base" or "base"
{ // opening braces
// scope of the members
private:
// visible within the same class
protected:
// visible to the same and derived classes
public:
//visible to all
}// closing braces
- How access Class mmbers
- Member access operators:
- – Dot operator (.) for structures and objects
- Classinstance.ClassObject
- -Arrow operator (->) for pointers
– Print member hour of timeObject:
cout <<mcptr->print();
clsptr->print2(12);
- --------------------
mcptr->print(); is same as
(mcptr).print()
-- Parentheses required:
--* has lower precedence than .
|