0

PLEASE HELP i got Error !!!

When i created program for Destructor I got errors as shown in the code https://code.sololearn.com/cqEiPnL7z5FH/?ref=app

11th Apr 2020, 2:14 PM
Shubham Rankhambe
4 Answers
+ 4
You have a semicolon ; after destructor declaration. Remove that and enclose associated statement in { } alternatively , you can also define it outside class and keep declaration in class. my::~my(){ cout<<count<<"Object Destroyed"; count -- ; } //use this outside class. Next thing, You need to define the static variables outside class that you declare inside class. int my::count = 0; //use this outside class. You can refer this code: https://code.sololearn.com/ckvqxZPZi108/?ref=app
11th Apr 2020, 2:27 PM
šŸ‡®šŸ‡³OmkaršŸ•‰
šŸ‡®šŸ‡³OmkaršŸ•‰ - avatar
+ 1
Ok Omkar Bro Thank You very Much for detailed Explanation šŸ˜Š
11th Apr 2020, 2:30 PM
Shubham Rankhambe
0
Hi. you forgot curly braces {}. Just compare with constructor definition
11th Apr 2020, 2:27 PM
Stephan
Stephan - avatar
0
Ok Russian bro I doesn't Understand your name but thank you
11th Apr 2020, 2:31 PM
Shubham Rankhambe