by Dinesh Thakur Category: Classes in C++

The const qualifier is used with the variables of basic data types to prevent them from being modified by the function. In a similar way, const qualifier can also be applied to member functions, member function arguments and the objects of a class.



 
by Dinesh Thakur Category: Classes in C++

Polymorphism (a Greek word meaning having multiple forms) is the ability of an entity such as a function or a message to be processed in more than one form. It can also be defined as the property of an object belonging to a same or different class to respond to the same message or function in a different way. For example, if a message change_gear is passed to all the vehicles then the automobiles will respond to the message appropriately however, the pulled vehicles will not respond. The concept of polymorphism plays an important role in OOP as it allows an entity to be represented in various forms.

 
by Dinesh Thakur Category: Classes in C++

Abstraction is a mechanism to' hide irrelevant details and represent only the essential features so that one can focus on important things at a time; It allows managing complex systems by concentrating on the essential features only. For example, while driving a car, a driver only knows the essential features to drive a car such as how to use clutch, brake, accelerator, gears, steering, etc., and least bothers about the internal details of the car like motor, engine, wiring, etc.

 
by Dinesh Thakur Category: Classes in C++

In the Hierarchical Inheritance, when we use The Same Data Member in the Sub Class Then the Data Member will Contains the Many values So that here Data Member will be Ambiguous Because a Single Data Member have two or more values.

 
by Dinesh Thakur Category: Classes in C++

1: Public, protected and private are three access specifier in C++. Public data members and member functions are accessible outside the class. Protected data members and member functions are only available to derived classes. Private data members and member functions can’t be accessed outside the class. However there is an exception can be using friend classes. Write a function that swaps the values of two integers, using int* as the argument type.

 
by Dinesh Thakur Category: Classes in C++

Class : Class is a user-defined data type in C++. It can be created to solve a particular kind of problem. After creation the user need not know the specifics of the working of a class. Class is a successor of Structure. By default all the members inside the class are private.



 
by Dinesh Thakur Category: Classes in C++

Encapsulation is the technique of binding or keeping together the data and the functions (that operate on them) in a single unit called a class. Encapsulation is the way to implement data abstraction. A well-encapsulated object acts as a 'black box' for other parts of the program. That is, it provides services to the external functions or other objects that interact with it. However, these external functions or the objects do not need to know its internal details. For example, the data p_code, p_name, p_price and qty_in_hand and the functions display-product() and check_qty are encapsulated in a class Product.

 
by Dinesh Thakur Category: Classes in C++

Friend classes are used when two or more classes are designed to work together and need access to each other's implementation in ways that the rest of the world shouldn't be allowed to have. In other words, they help keep private things private. For instance, it may be desirable for class DatabaseCursor to have more privilege to the internals of class Database than main() has.

 

Page 2 of 6



About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.



Related Articles