bsc

Comprehensive codebase and cou...
Log | Files | Refs | Activity | README | LICENSE

commit a4faf866266ad129da574bef74093021f2eb3f98
parent ca1fc394db06550f032bfe848a8e7eb8eac188a9
Author: Amit Dutta <mail@amit.is-a.dev>
Date:   Mon, 27 Jul 2026 20:17:47 +0530

Merge pull request #13 from notamitgamer/feature-20260727-201544

added some definitions
Diffstat:
Asemester_2/eduincs/pgrm_014.cpp | 30++++++++++++++++++++++++++++++
Asemester_2/eduincs/pgrm_015.cpp | 36++++++++++++++++++++++++++++++++++++
2 files changed, 66 insertions(+), 0 deletions(-)

diff --git a/semester_2/eduincs/pgrm_014.cpp b/semester_2/eduincs/pgrm_014.cpp @@ -0,0 +1,30 @@ +/* + * Author: Amit Dutta <amitdutta4255@gmail.com> + * Repo: https://github.com/notamitgamer/bsc + * License: MIT + */ +/* `this` pointer */ + +#include<iostream> +using namespace std; +class myclass { +private: + int value1; + int value2; +public: + void setValue(int v, int value2) { + this -> value1 = v; + this -> value2 = value2; + } + void printValue() { + cout << "Value1: " << this -> value1 << endl; + cout << "Value2: " << this -> value2; + } +}; + +int main() { + myclass obj; + obj.setValue(23, 123); + obj.printValue(); + return 0; +} diff --git a/semester_2/eduincs/pgrm_015.cpp b/semester_2/eduincs/pgrm_015.cpp @@ -0,0 +1,36 @@ +/* + * Author: Amit Dutta <mail@amit.is-a.dev> + * Repo: https://github.com/notamitgamer/bsc + * License: MIT + */ +/* `friend` function */ + +#include<iostream> +using namespace std; +class rectangle { + int length, breadth; +public: + rectangle() {}; + rectangle(int l, int b) {length = l; breadth = b;} + + int area() { + return length * breadth; + } + friend rectangle double_dimen(const rectangle &); +}; + +rectangle double_dimen(const rectangle &param) { + rectangle res; + res.length = param.length * 2; + res.breadth = param.breadth * 2; + return res; +} + +int main() { + rectangle obj; + rectangle obj2(2, 3); + cout << "Area of obj2: " << obj2.area() << endl; + obj = double_dimen(obj2); + cout << "After magnify: \nArea of obj: " << obj.area() << endl; + return 0; +}
© notamitgamer • Site Built: 2026-09-05 01:53:16 UTC • git-mirror commit: c170d72 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror