8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0fa51de commit b87aedcCopy full SHA for b87aedc
ClassAndObject/Practice Code/ClassTypecast.cpp
@@ -0,0 +1,31 @@
1
+#include<iostream>
2
+
3
+class Demo {
4
5
+ int x = 10;
6
+ float y = 12.5f;
7
+ public:
8
+ Demo() {
9
10
+ }
11
+ Demo(int x, float y) {
12
13
+ this->x = x;
14
+ this->y = y;
15
16
+ void getData() {
17
18
+ std::cout << x << std::endl;
19
+ std::cout << (float)y << std::endl;
20
21
22
+};
23
+int main() {
24
25
+ Demo obj1;
26
+ obj1.getData();
27
+ Demo obj = (Demo){40, 45.6f};
28
+ obj.getData();
29
30
+ return 0;
31
+}
0 commit comments