Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 72eaecf

Browse files
Update Class-Objects.MD
1 parent 8e07298 commit 72eaecf

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

‎Object Oriented Programming/L2 - Class and Objects/Class-Objects.MD‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -339,19 +339,23 @@ class A{
339339
A(){
340340
a = 10;
341341
s = "ecernwala";
342-
System.out.println(a + " " + b);
342+
System.out.println(a + " " + s);
343343
}
344344
A(A ref){
345345
a = ref.a;
346-
b = ref.s;
347-
System.out.println(a + " " + b);
346+
s = ref.s;
347+
System.out.println(a + " " + s);
348+
}
349+
public void display(){
350+
System.out.println("Copy Constructor");
348351
}
349352
}
350353
351354
class copyConstructor {
352355
public static void main(String[] args){
353356
A r = new A();
354-
A r1 = new A(r);
357+
A r2 = new A(r);
358+
r2.display();
355359
}
356360
}
357361
```

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /