Object-Oriented Programming in C++

 

Object-Oriented Programming in C++



C++ programming language supports both procedural-oriented and object-oriented programming. The above example is based on the procedural-oriented programming paradigm. So let’s take another example to discuss Object Oriented Programming in C++.

11)Class

A class is a template of an object. For example, the animal is a class & dog is the object of the animal class. It is a user-defined data type. A class has its own attributes (data members) and behavior (member functions). The first letter of the class name is always capitalized & use the class keyword for creating the class.

In line #3, we have declared a class named Calculate and its body expands from line #3 to line #7.

Syntax:



Popular posts from this blog

Data Types – Sizes & Memor C++.

Whitespace in C++