Docsity

Object-Oriented Programming: Classes, Constructors, and Destructors, Slides of Computer Programming

Partial preview of the text

Download Object-Oriented Programming: Classes, Constructors, and Destructors and more Slides Computer Programming in PDF only on Docsity!

Introduction of Programming

Lecture 27

Today’s Lecture

  • Classes and objects
  • Constructors
  • Destructors
  • Member functions
  • Member data

Object Oriented

Multiple Media

Data Hiding

Encapsulation

Constructor

The majority of programming problems occur because of the use of un-initialized data.

Constructor

 Name of the constructor is same

as the name of the class

 It does not return any thing, not

even void

Function Overloading

Rules of function overloading

When ever we overload a function,

the name of the function remain the

same but argument list changes.

The argument list can:

  • Either vary in the number of arguments
  • Or vary in the type

main ( )

Date mydate ( ) ;

Example

main ( ) { Date mydate ( “01-Jan-2002” ) ; } Example

Utility Functions

Friend Functions