Classes and Objects

Untitled


Task 1:

(IIT VLabs):

Visit the below link and complete the pretest, simulation, and posttest tabs:

http://vlabs.iitb.ac.in/vlabs-dev/labs/oops/labs/exp2/index.php


Task 2:

First, create the main program as in the first exercise.

Next, define a new class in its own .cpp and .h file. Call the class Car. Give it a single method called "start". Make the method simply print "Car start.

In your main program, create a new Car object and call its start() method.

Your final program should simply, therefore, display the text "Car started!".

#include <iostream>
using namespace std;
class car {
public:
  void start(void) { 
    cout << endl << "Car started" << endl; 
    }
};
int main() {
  class car c1;
  c1.start();
}

Untitled


Task 3: