From 5d44791fc27f0e8998bfc6fe4e8c628de7f557c5 Mon Sep 17 00:00:00 2001 From: Manisha Kundnani <90680330+Manishak798@users.noreply.github.com> Date: Wed, 14 Feb 2024 09:03:34 +0530 Subject: [PATCH] Add files via upload --- OOPS/inheritance.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 OOPS/inheritance.cpp diff --git a/OOPS/inheritance.cpp b/OOPS/inheritance.cpp new file mode 100644 index 0000000..0bfe2ee --- /dev/null +++ b/OOPS/inheritance.cpp @@ -0,0 +1,24 @@ +#include +using namespace std; +class Vehicle +{ +public: + string brand = "ford"; + void honk() + { + cout << "tuut, tuut...."; + } +}; +class Car : public Vehicle +{ +public: + string model = "Mustang"; +}; +int main() +{ + Car myObj; + myObj.honk(); + cout << endl; + cout << myObj.brand << " " << myObj.model; + return 0; +} \ No newline at end of file