OOP-02-Introduction To Object Oriented Programming-English
OOP-02-Introduction To Object Oriented Programming-English
Object Oriented
Programming
Nguyễn Minh Huy
Person1: Person2:
Name: Peter. Name: Thomas.
Eat(). Eat( ).
Work(). Work( ).
Scope control:
Keyword Scope
private Inside class only.
public Inside and outside class.
protected Inside class and children class.
class Fraction
{
private:
int m_num
m_num;;
Attributes
int m_denom
m_denom;;
public:
Fraction add( Fraction p ); Methods
Fraction reduce( );
};
Object usage:
Class declaration.
Class implementation.
Scope:
Working range.
Keywords: public, private, protected.