i am taking a c++ class. please answer these four question detailedly.
thank you in advance.
Q1. Benefits of Object Oriented Programming:
Object Oriented Programming provides a clear structure.
Object Oriented Programming helps us to create datatypes of our own
choice with a feature to hide details that you don't want to show
to your user.
Objects in Object Oriented Programming are reusable. This reuse
ability helps us to lower the development cost.
Object Oriented Programming structure is easier to maintain, it is
fast.
Object Oriented Programming is used to define abstract data
types.
Q2. Object Reusability:
It is quiet expensive to create an object every time we need it
increases our cost and consume our time. However the object reuse
ability helps us to reuse the object you created earlier for
further use. It means that the class to which the object is
belonged will be created and debugged only for once and will be
distributed to that program in which the object was created
earlier
Data Hiding:
Data hiding is a technique which we use in Object oriented programming to hide the data members or some functions from outside the class this technique won't let other classes or functions to access those members or functions that are hidden. Data hiding technique is used to only show functions or data members which are needed to show to user this avoid complexity to the user as he have no concern that what goes in backend.
Q3. Access data members of a structure/class:
Only data members which are public can be accessed of a class or a struct by default struct is public and by default class is private. To access the data members we have to create an object of that struct or class and that object is based on what constructor we have made for that struct or class by default struct and class has a built in constructor but they can also have a parameterize constructor. After declaring the object if it's a pointer base object we can access them by using a " -> " symbol this symbol is used to access pointer type objects and for simple objects we use " . " dot operator to access data members. Protected members can also be accessed outside the class.
Q4. Passing array to a function:
There are few ways to pass an array to a function like by reference , by value or by pointer. By reference we pass array to a function by sending its address of first index. By pointer we sent an array of pointer into a function and the pointer is pointing to the first index of the array and by value we just pass the array to the function and it begins with the first index.
void fun(int [ ], int size);
void fun (int(&)[size ]);
void fun( int * ,int size);
These are some ways to pass an array to a function
IF YOU HAVE ANY QUERY PLEASE COMMENT DOWN BELOW
PLEASE COMMENT DOWN BELOW
i am taking a c++ class. please answer these four question detailedly. thank you in...
I am having difficulty with completing this task. thank you. Task 10.1 (a) Define a C++ base class named Rectangle containing length and width data members. From this class, derive a class named Box with another data member named depth. The member functions for the base class Rectangle should consist of a constructor and an area() function. The derived class Box should have a constructor, a volume() function and an override function named area() that returns the surface area of...
I need this in C++. This is all
one question.
Introduction Your eighth assignment will consist of two programs, which will involve the use of simple classes. The source code for these problems should be submitted using the naming conventions we specified in class. Please note that your computer programs should comply with the commenting and formatting rules as described in class. For example, there should be a header for the whole program that gives the author's name, class name,...
Context of my question: I am reading C#. Trying to understand Static keyword. I understand that when Static is applied to a member of a class, it can only be modified by the class and not the class object references. I will take an example here. public class BluePrint { public static string BluePrintCreatorName; } If I need to know the BluePrintCreator's Name, I can call BluePrint.BluePrintCreatorName; But if a house that is created from the blueprint wants to...
members of a class non-friends, non-members of a class All of the above be 13. Why do you want to usually make data members private in a class? so that no one can use the class ensure data integrity b. provide data abstraction c provide information hiding. d. e. Band D B.C and D 14. The copy constructor for a class is called when an object of the class is passed by value to a function. when an object of...
I need help with this java project and please follow the instruction below. thank Class Project - Parking Ticket simulator Design a set of classes that work together to simulate a police officer issuing a parking ticket. Design the following classes: • The ParkedCar Class: This class should simulate a parked car. The class’s responsibilities are as follows: – To know the car’s make, model, color, license number, and the number of minutes that the car has been parked. • ...
Please show it in C++. Thank you!
Problem Definition Create an inheritance hierarchy containing base class Account and derived class Savings-Account. Base class Account should include one data member of type double to represent the account balance. The class should provide a constructor that receives an initial baiance and uses it to initialize the data member. The class should provide three member functions. Member function credit should add an amount to the current balance. Member function debit should withdraw money...
Either know this is just a homework assignment please if you dont know the answer or if you dont check that its right please dont work on this serious answers only please and thank you and no java only visual studio c++ please. Q1 : Classes and Objects 1. Create a class definition for an object called Account. Add a constructor and destructor to it. 2. Add 2 internal data member of char or string type which should be named...
Can you help me? I am taking an INTRODUCTORY unix/linux shell programming course and need to know what the following command will do. Need a SIMPLE answer please. onsystem john1 &
If your program does not compile, you will not receive any points! You will write a program to keep up with a Jewelry store and some of the Inventory (rings/necklaces/earrings) purchased there (The Jewelry store can be real or not) using Object-Oriented Programming (OOP). The important aspect of object-oriented programming is modular development and testing of reusable software modules. You love selling rings, necklaces, and earrings as well as programming and have decided to open a Jewelry store. To save...
1. What is the structure of a relational database? How do you implement a simple relational database in Python and what are some of the benefits? 2. What is the purpose of the “self” argument in the method definitions of a class 3.What does operator-overloading mean in Python? Give an example. 4.Describe the meaning of polymorphism in Object Oriented Programming. Give an example of polymorphism and how it works when the program is executing. 5.What is inheritance in object-oriented design?...