Complete the code to create an object of class Car named myCar.
class Car {}; int main() { [1] myCar; return 0; }
To create an object, use the class name followed by the object name.
Complete the code to create an object book1 of class Book using the default constructor.
class Book { public: Book() {} }; int main() { [1] book1; return 0; }
Use the class name Book to create an object book1.
Fix the error in creating an object circle1 of class Circle.
class Circle { public: Circle(double r) {} }; int main() { Circle [1]; return 0; }
The constructor requires a double parameter. Use Circle circle1(5.0); to create the object.
Fill both blanks to create an object student1 of class Student using the constructor with parameters.
class Student { public: Student(std::string n, int a) {} }; int main() { [1] [2]("Alice", 20); return 0; }
Use the class name and object name to create the object with parameters.
Fill all three blanks to create an object employee1 of class Employee using the constructor with parameters.
class Employee { public: Employee(std::string id, double s) {} }; int main() { [1] [2]([3]); return 0; }
Use the class name, object name, and provide the parameters inside parentheses.