-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #83 from yashrajmani/main
added OOPs basic code
- Loading branch information
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#include <iostream> | ||
using namespace std; | ||
|
||
class car | ||
{ | ||
char col[10]; | ||
public: | ||
int speed; | ||
void get(int distance, int fuel) | ||
{ | ||
cout << "the car has DISTANCE :" << distance << "FUEL :" << fuel << endl; | ||
} | ||
void milage(float distance, float fuel); | ||
|
||
void carspeed() | ||
{ | ||
cout << "SPEED " << speed; | ||
} | ||
|
||
} audi; | ||
|
||
void car ::milage(float d, float f) | ||
{ | ||
float carmil = d / f; | ||
cout << "MILAGE IS :" << carmil << endl; | ||
} | ||
|
||
int main() | ||
{ | ||
car swift; | ||
swift.get(10, 10); | ||
audi.get(19, 20); | ||
audi.milage(1900, 20); | ||
swift.speed = 10; | ||
swift.carspeed(); | ||
return 0; | ||
} |