a) Code can be written without using classes
b) Code must contain at least one class
c) A class must have member functions
d) At least one object should be declared in code
In C++, it’s not necessary to use classes, and hence codes can be written without using OOP concept. Classes may or may not contain member functions, so it’s not a necessary condition in C++. And, an object can only be declared in a code if its class is defined/included via header file.
a) Default class
b) String class
c) Template class
d) Abstract class
Abstract classes can have member functions with no implementation, where the inheriting subclasses must implement those functions.
a) All member functions must be defined
b) Member functions can be defined inside or outside the class body
c) Member functions need not be declared inside the class definition
d) Member functions can be made friend to another class using the friend keyword
Member functions must be declared inside class body, though the definition can be given outside the class body. There is no way to declare the member functions outside the class.
a) Instance of a class
b) Instance of itself
c) Child of a class
d) Overview of a class
An object is instance of its class. It can be declared in the same way that a variable is declared, only thing is you have to use class name as the data type.
a) class student{ }; student s;
b) abstract class student{ }; student s;
c) abstract class student{ }s[50000000];
d) abstract class student{ }; class toppers: public student{ }; topper t;
We can never create instance of an abstract class. Abstract classes doesn’t have constructors and hence when an instance is created there is no facility to initialize its members. Option d is correct because topper class is inheriting the base abstract class student, and hence topper class object can be created easily.
Items per page: