bsc

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

commit 5c034f065870ddb524f5f808805623afa8fe15e1
parent ed11d71ed3e077a53a17e3ad9a514e86fd37e322
Author: Amit Dutta <mail@amit.is-a.dev>
Date:   Tue, 25 Aug 2026 21:20:21 +0530

copy

Diffstat:
Asemester_2/eduincs/pgrm_017.cpp | 37+++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+), 0 deletions(-)

diff --git a/semester_2/eduincs/pgrm_017.cpp b/semester_2/eduincs/pgrm_017.cpp @@ -0,0 +1,37 @@ +/* + * Author: Amit Dutta <amitdutta4255@gmail.com> | Date: 25 Aug 2026 + * Repo: https://github.com/notamitgamer/bsc + * License: MIT + */ + +/* Copy Constructor */ + +#include<iostream> +using namespace std; +class A { +private: + int x; + double y; +public: + A(int a, double b) { + x = a; y = b; + } + A(A & ob) { + // Copy constructor + x = ob.x; + y = ob.y; + } + void display() { + cout << "x = " << x << " y = " << y << endl; + } +}; + +int main() { + A obj(20, 23.5); + cout << "obj: "; + obj.display(); + A obj2(obj); + cout << "obj2: "; + obj2.display(); + 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