declare a default constructor named Cat
Cat();
can classes have paramiters?
no
data members are declared in _____ part of the class
public
varies
when defining a member function, what symbol is used to show that the member function belongs to the class
::
true or false: constructors have the same name as the class
True
This keyword specifies that members of a class are accessible from outside the class.
public
What are data members?
Variables that hold data specific to each object of the class.
what are two commonly used examples of objects in C++
cin, cout
true or false: you define a member function in the class under public
false; you declare a member function in the class under public
this type of constructor initializes member variables with default values
default constructors
this keyword specifies that no change will be made to existing variables
const
True or false: you can initialize a data member in the private section
True
what is the difference between setters and mutators
mutators change values and setters set values
where do you declare a member function?
in the class, under public
what is the difference between a default constructer and a parametrized constructer
default constructer have no perimeter and don't set values whilst parametrized constructer do
The process of providing a public interface while hiding the implementation details is called ____
encapsulation
declare a data member that is named salary
double salary;
or
int salary
How do you ensure that data members of a class are initialized with specific values when an object is created?
by using a constructor
what is the difference between getters and setters?
getters output information back to user. setters do not output information back to user but instead update the value of data members
what is wrong with with this statement: you define constructers with the rest of the member functions
constructers arent defined, they are declared
true or false: is this class correctly defined, if false state error:
class Student()
{
public:
void eat();
void sleep();
void study();
void procrastinate();
private
string school;
string grade;
string name;
}
false, ending bracket missing a semicolon
whats makes data member variables different from regular variables
their scopes are different
why use a class instead of a structure?
classes provide better encapsulation and support for more complex systems with constructors
define a already declared member function named get_income belonging to the class "Job".(assume there is a already declared data member named income )
void Job::get_income(double income)
{
return income;
}