OOP USING C++
Creating an object of a Class
§ Declaring
a variable of a class type creates an object. You can have many variables of
the same type (class).
– Instantiation
§ Once an
object of a certain class is instantiated, a new memory location is created for
it to store its data members and code
§ You can
instantiate many objects from a class type.
Ex)
Circle c; Circle *
Implementing class methods
§ Class
implementation: writing the code of class methods.
§ There are
two ways:
1. Member
functions defined outside class
§ Using
Binary scope resolution operator (::)
§ “Ties”
member name to class name
§ Uniquely
identify functions of particular class
§ Different
classes can have member functions with same name
2. Format
for defining member functions
ReturnType
ClassName::MemberFunctionName( ){
…
Related Topics
Privacy Policy, Terms and Conditions, DMCA Policy and Compliant
Copyright © 2018-2023 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.