Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Find the errors in the class definitions below (there are 5): class Date { Priva

ID: 3532513 • Letter: F

Question

Find the errors in the class definitions below (there are 5): class Date { Private int myDay; int myMonth; int myYear; void checkDate (int m, int d, int y); Public Date (); Date (int m, int d,int y); int getMonth() const; int getDay() const; int getYear() const; void print () const; Find 2 errors class myClass { public: myClass(); int calculateValue(int vaM. int val2); //adds val1 and val2 and returns the value private: int sum; bool check_values(int parameter1, parameter2); //checks that parameter1 and parameter2 are nonzero positive integers } In an abstract data type, should the member variables be public or private? Should the member functions be public or private? What is the relationship between class A and class B if class A is a parent of class B? True/false: Is istream a derived class of ifstream? What does inheritance in coding apply to? Describe a constructor and what it does. accessor and mutator functions. In the definition void BankAccount::update(), why is the :: used? True/false: Should you always include a constructor?

Explanation / Answer

1.) line 6: the function should not be used under private

line 2: private:, : mark after private

line 5: public:, : martk after public

line 8:function can not be called in a class

line 9 10 11 12 : const can not be used there

2.) line 3: function can not be called inside a class

line 8: bool chek_values(int parameter1,int parameter2)

3.) member functions and member variables should be public

4.) class B is a derived class from class A

5.) false

6.) in inheritance we inherite the featurs of one class into other class..

the class from which the features if inherited is parent class and the other is derived clas

7.) A constructor is a special method that is created when the object is created or defined. This particular method holds the same name as that of the object and it initializes the instance of the object whenever that object is created. The constructor also usually holds the initializations of the different declared member variables of its object. Unlike some of the other methods, the constructor does not return a value, not even void.

When you create an object, if you do not declare a constructor, the compiler would create one for your program; this is useful because it lets all other objects and functions of the program know that this object exists. This compiler created constructor is called the default constructor. If you want to declare your own constructor, simply add a method with the same name as the object in the public section of the object. When you declare an instance of an object, whether you use that object or not, a constructor for the object is created and signals itself.

9.) :: is scope resolution operator to carry out inside functions

10.) no

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote